Rails routes direct index action to show action

Posted by jspooner on Stack Overflow See other posts from Stack Overflow or by jspooner
Published on 2010-04-20T16:54:37Z Indexed on 2010/04/20 17:23 UTC
Read the original article Hit count: 508

Filed under:
|

So I created some rspec_scaffold for an Exercise model and added "map.resource :exercises" to my routes file and I was surprised when the "/exercises" url rendered the show action. What the heck? Why doesn't that render the index action?

rake routes

new_exercises GET    /exercises/new(.:format)                           {:controller=>"exercises", :action=>"new"}
                edit_exercises GET    /exercises/edit(.:format)                          {:controller=>"exercises", :action=>"edit"}
                     exercises GET    /exercises(.:format)                               {:controller=>"exercises", :action=>"show"}
                               PUT    /exercises(.:format)                               {:controller=>"exercises", :action=>"update"}
                               DELETE /exercises(.:format)                               {:controller=>"exercises", :action=>"destroy"}
                               POST   /exercises(.:format)                               {:controller=>"exercises", :action=>"create"}

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routes