Time To Phase Out Rails Constants

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 root and 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_ROOT and RAILS_ENV are probably not going anywhere anytime soon, but I think this a step in the right direction.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s