Skip to content

Instantly share code, notes, and snippets.

@ngw
Created October 19, 2010 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngw/634996 to your computer and use it in GitHub Desktop.
Save ngw/634996 to your computer and use it in GitHub Desktop.
map.resources :brands
brands GET /brands(.:format) {:controller=>"brands", :action=>"index"}
POST /brands(.:format) {:controller=>"brands", :action=>"create"}
new_brand GET /brands/new(.:format) {:controller=>"brands", :action=>"new"}
edit_brand GET /brands/:id/edit(.:format) {:controller=>"brands", :action=>"edit"}
brand GET /brands/:id(.:format) {:controller=>"brands", :action=>"show"}
PUT /brands/:id(.:format) {:controller=>"brands", :action=>"update"}
DELETE /brands/:id(.:format) {:controller=>"brands", :action=>"destroy"}
ruby-1.8.7-p253 > rs = ActionController::Routing::Routes
ruby-1.8.7-p253 > app.brand_path( 'lol' )
=> "/brands/lol"
rs.recognize_path app.brand_path( 'lol' )
=> {:controller=>"brands", :action=>"lol"}
???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment