开发者

inherited resources: routes with nested resources

In my routes.rb I have:

resources :fire_prev开发者_开发知识库entions do
   get 'search_adv', :on => :collection
end

How can I use it with inherited resources routes?

search_adv_collection_url doesn't work.


You can execute rake routes in comand line. It will print all available paths according to routes.rb


As there is only one route listed,

resources :fire_preventions do 
  get 'search_adv', :on => :collection 
end

is shorten form for getting rid of the additional block

resources :fire_preventions do 
  collection do
    get 'search_adv'
  end
end

You should be able to use search_adv_fire_preventions_path and search_adv_fire_preventions_url. It's best that you perform rake routes to check this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜