I just replied to someone about using send_file and while I was testing my solution I figured out that the controllers "current working dir" appears to be the root of the app. Then I saw a reply that Ezra sent to someone where he used RAILS_ROOT and I thought "duh, I''ve seen that before... shoulda used that". But, when I had an action print out RAILS_ROOT it''s "./script/../config/..". I''m probably being dense here, but what, why, huh? What does that mean and why isn''t RAILS_ROOT the full system path to the app? b
On Feb 19, 2006, at 11:44 PM, Ben Munat wrote:> I just replied to someone about using send_file and while I was > testing my solution I figured out that the controllers "current > working dir" appears to be the root of the app. > > Then I saw a reply that Ezra sent to someone where he used > RAILS_ROOT and I thought "duh, I''ve seen that before... shoulda > used that". > > But, when I had an action print out RAILS_ROOT it''s "./script/../ > config/..". I''m probably being dense here, but what, why, huh? What > does that mean and why isn''t RAILS_ROOT the full system path to the > app? > > b > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Ben- Thats just what ruby sees inside itself sort of. If you look at what that path does though you can see why. the first part ./script is where you started rails from script/server. then it goes /../config which means it went up a dir from script and down into config. Then it does /.. at the end which means it went back up from config into the root of your rails app. Don''t ask why it does all that but it does end up pointing to the real RAILS_ROOT ;-) Cheers- -Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra@yakima-herald.com 509-577-7732
Ezra Zygmuntowicz wrote:> > On Feb 19, 2006, at 11:44 PM, Ben Munat wrote: > >> I just replied to someone about using send_file and while I was >> testing my solution I figured out that the controllers "current >> working dir" appears to be the root of the app. >> >> Then I saw a reply that Ezra sent to someone where he used RAILS_ROOT >> and I thought "duh, I''ve seen that before... shoulda used that". >> >> But, when I had an action print out RAILS_ROOT it''s "./script/../ >> config/..". I''m probably being dense here, but what, why, huh? What >> does that mean and why isn''t RAILS_ROOT the full system path to the app? >> >> b >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > Ben- > > Thats just what ruby sees inside itself sort of. If you look at > what that path does though you can see why. the first part ./script is > where you started rails from script/server. then it goes /../config > which means it went up a dir from script and down into config. Then it > does /.. at the end which means it went back up from config into the > root of your rails app. Don''t ask why it does all that but it does end > up pointing to the real RAILS_ROOT ;-) > > Cheers- > -Ezra ZygmuntowiczThanks EZ... makes sense... I guess. :-/ b
You can do File.expand_path(RAILS_ROOT) to get a nice path. Ben Munat wrote:> Ezra Zygmuntowicz wrote: >>> But, when I had an action print out RAILS_ROOT it''s "./script/../ >> Ben- >> -Ezra Zygmuntowicz > Thanks EZ... makes sense... I guess. :-/ > > b-- Posted via http://www.ruby-forum.com/.