code_junkie

Default segment name in rails resources routing

Nov 11th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. /panda/blog
  2. /tiger/blog
  3. /dog/blog
  4.  
  5. map.resources :animals do |animal|
  6. animal.resource :blog
  7. end
  8.  
  9. /animals/panda/blog
  10. /animals/tiger/blog
  11. /animals/dog/blog
  12.  
  13. resources :animals, :path => ""
  14.  
  15. $ rake routes
  16.  
  17. animals GET / {:action=>"index", :controller=>"animals"}
  18. POST / {:action=>"create", :controller=>"animals"}
  19. new_animal GET /new(.:format) {:action=>"new", :controller=>"animals"}
  20. edit_animal GET /:id/edit(.:format) {:action=>"edit", :controller=>"animals"}
  21. animal GET /:id(.:format) {:action=>"show", :controller=>"animals"}
  22. PUT /:id(.:format) {:action=>"update", :controller=>"animals"}
  23. DELETE /:id(.:format) {:action=>"destroy", :controller=>"animals"}
Add Comment
Please, Sign In to add comment