Single custom param name in routes for nested resources Rails 4.1

后端 未结 2 1392
孤街浪徒
孤街浪徒 2021-02-09 05:04

I have question about param name for nested resources in rails routes For example i have:

resources :controller1, param: :controller_id do
  resources :controlle         


        
相关标签:
2条回答
  • 2021-02-09 05:36

    Try this and see;

    resources :controller1, param: :controller_id, path: "" do
      resources :controller2, path: ""
    end
    
    0 讨论(0)
  • 2021-02-09 05:38

    how about this:

    resources :controller1, param: :controller_id do
      member do
        resources :controller2
      end
    end
    

    will generate

    GET    /controller1/:controller_id
    GET    /controller1/:controller_id/controller2
    GET    /controller1/:controller_id/controller2/:id
    ...
    
    0 讨论(0)
提交回复
热议问题