Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 744
mportiz08 Avatar asked May 29 '10 00:05

mportiz08


1 Answers

Yes, you should require the environment.rb:

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

And Rails.root instead.

like image 144
Leventix Avatar answered Oct 01 '22 08:10

Leventix