This project is archived and is in readonly mode.

#5513 ✓resolved
Andrew White

Nested resource constraints are applied incorrectly

Reported by Andrew White | August 31st, 2010 @ 05:52 PM | in 3.0.2

When using nested resource id constraints the options are applied incorrectly because the implicit nested call occurs after the options have been pushed out to the scope, e.g:

 resources :lists, :id => /([A-Za-z0-9]{25})|default/ do
   resources :todos, :id => /\d+/
 end

Specifying the routes in full gives the correct results:

 resources :lists, :constraints => { :id => /([A-Za-z0-9]{25})|default/ } do
   nested do
     resources :todos, :constraints => { :id => /\d+/ }
   end
 end

The attached patch moves the nested call before the options are processed.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages