26

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

ibuck
  • 495
  • 1
  • 5
  • 16

1 Answers1

62

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

Paige Ruten
  • 172,675
  • 36
  • 177
  • 197