mportiz08
mportiz08

Reputation: 10308

RAILS_ROOT require?

I'm trying to access the RAILS_ROOT constant in a file residing in the /lib directory, but I'm not able to (uninitialized constant error). Is there something that I need to require to be able to do this?

Upvotes: 19

Views: 10400

Answers (1)

Leventix
Leventix

Reputation: 3859

Yes, you should require the environment.rb:

require File.dirname(__FILE__) + '/../config/environment.rb'
puts RAILS_ROOT

And Rails.root instead.

Upvotes: 28

Related Questions