Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Nested resource constraints are applied incorrectly

#5513

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.

Reported by Andrew White · August 31st, 2010 @ 05:52 PM

State: resolved
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. José Valim
    José Valim

    Andrew, sorry but the patch no longer applied. Could you please rebase?

    September 1st, 2010 @ 08:45 AM

  2. Andrew White
  3. Andrew White
    Andrew White

    The patch also applies cleanly to 3-0-stable as well

    September 1st, 2010 @ 09:05 AM

  4. Repository
    Repository
    • State changed from open to resolved

    (from [9441eabbbfd46b117fe4ea4667369e5564def9cb]) Move implicit nested call before options handling so that nested constraints work [#5513 Nested resource constraints are applied incorrectly state:resolved]

    Signed-off-by: José Valim jose.valim@gmail.com
    http://github.com/rails/rails/commit/9441eabbbfd46b117fe4ea4667369e...

    September 1st, 2010 @ 09:15 AM

  5. Repository
  6. Jeremy Kemper