It you define constraint on "id" in parent resource:
resources :foo, constraints: { :id => /CONST/ } do
resources :bar
end
The nested resource will inherits that constraint for its own id, thus the generated routes will be like:
/foo/:foo_id/bar/:id/edit(.:format)
{:id=>/CONST/, :foo_id=>/CONST/, :action=>"edit", :controller=>"bar"}
So, I don't want the "id" parameter of Bar resource to be that restricted.
Currently, I've just map the routes I want manually, one by one, but I am really want to generate it by resources helper. How can I do that?
How about :
resources :foo, constraints: { :id => /CONST/ }
resources :foo, constraints: { :foo_id => /CONST/ } do
resources :bar
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With