Time To Phase Out Rails Constants

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 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.

Entry Filed under: rails. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

Blog Stats

 

October 2008
S M T W T F S
« Sep   Nov »
 1234
567891011
12131415161718
19202122232425
262728293031  

Blogroll

Categories

Top Posts