Both objects seem to be nil inside of ‘rails console’.
Why is that?
Actually now Rails works:
puts Rails.env
/path/to/my/project
but for config:
puts config.root
NameError: undefined local variable or method `config' for #<Object:0x1001dd2a0>
from (irb):8
There is no global
configmethod. If you’re copying this from your environment files in Rails 2, note that these are actually evaluated within a certain context.To get to the
configobject from your console, try one of the following:For Rails 3 and above:
For Rails 2.x:
If you need to get your project’s root directory (not sure if this is actually what you’re trying to accomplish), you can do the following in Rails 2 and above: