Hi all,
I was wondering if there was a kosher way of getting the complete path to the root location of a Rails app? I know there's ROOT_PATH, but I think that changes when I do Dir.chdir() to some other location. Or at least it's what I am seeing.
For example:
Dir.pwd
=> "/Users/diego/Code/Rails/mview"
puts RAILS_ROOT
script/../config/../config/.. => nil
Dir.chdir('/')
=> 0
puts RAILS_ROOT
script/../config/../config/.. => nil
Dir.pwd
=> "/"
So basically anytime I do a chdir, away from the Rails root dir, I can no longer use RAILS_ROOT to get a starting point to do file and directory work.
Do I just need to define a global const with my app's complete path and use that?
Cheers, Diego