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 开发者_如何学Gono index action mapped for the default /buildings GET request? I'm using rails 3.0.3
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
精彩评论