Rails Magic with Named Routes
Something I just... never noticed before, I guess: Rails' named routes.
map.board '', :controller => 'gripes', :action => 'index'
map.category 'gripes/:category', :controller => 'gripes', :action => 'by_category'
map.detail 'gripes/:category/:slug', :controller => 'gripes', :action => 'by_slug'
This allows you to do the following:
board_url
category_url :category => 'Wowee'
detail_url :category => 'Wowee', :slug => 'Nifty'
I thought it was pretty cool.

0 Comments:
Post a Comment
<< Home