开发者

Rails 3.0.3 resource route no index mapped?

开发者 https://www.devze.com 2023-02-08 00:35 出处:网络
I am trying to use a very simple resource route for my Buildings Controller. resource :buildings This results in the following mappings

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

0

精彩评论

暂无评论...
验证码 换一张
取 消