Rails: Getting Routed
Posted on January 22, 2007
Filed Under /dev/ruby | 362 views |
Jamis Buck, one of the core developers of Ruby on Rails, writes an indispensable Rails blog with the unweildy name of the { buckblogs :here }. I’ve been reading it daily, learning something new about Rails each day. Today’s post, Named, explicit routes is all about routing paths in Rails, something up until now I hadn’t been able to get my head around.
I understood them, I just didn’t see a need to use them nor was I understanding why anyone else was using them… until I read this part of today’s post:
Route generation using implicit routes is ugly, both internally and externally. I mean, seriously, who wants to type “link_to(person.name, :controller => ‘person’, :action => ‘show’, :id => person)” when they can type “link_to(person.name, person_url(person))”.
It was an “aha!” moment. Yet one more way to greatly simplify and reduce the code in my app. Less is more, baby!.