Time To Phase Out Rails ConstantsPosted: October 13, 2008
I haven’t seen this documented anywhere, but it looks like Ruby on Rails picked up something nice from the Merb playbook: The
Rails class now has the properties
env. That means that instead of typing
RAILS_ROOT, you can type
Rails.root (just like
Merb.root). Why bother, you ask? Because it’s much cleaner to keep all the Rails configuration stuff in one namespace. It also looks nicer in code. Mainly, it’s something I liked about Merb that I thought was missing in Rails, so I’m happy to see this kind of positive give-and-take between the two communities.
RAILS_ENV are probably not going anywhere anytime soon, but I think this a step in the right direction.