Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.0.3 resource route no index mapped?

Tags:

I am trying to use a very simple resource route for my Buildings Controller.

resource :buildings 

This results in the following mappings

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

Anyone know why there is no index action mapped for the default /buildings GET request? I'm using rails 3.0.3

like image 629
ibuck Avatar asked Feb 02 '11 22:02

ibuck


1 Answers

I think you want to use resources instead of resource. You can read about the difference here: http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-resource

like image 178
Paige Ruten Avatar answered Sep 20 '22 06:09

Paige Ruten