This project is archived and is in readonly mode.

Generate routes for nested resources with nil object
Reported by fuse | March 24th, 2010 @ 03:26 PM | in 2.3.6
When we have nested routes like this:
map.resources :families, :has_many => :people
Inside controllers and views:
family_people_path(1) => /families/1/people
but:
family_people_path(nil) => /families//people
Is it not supposed to raise a RoutingError ?
In console it does:
include ActionController::UrlWriter
family_people_path(nil)
ActionController::RoutingError: family_people_url failed to
generate from {:action=>"index", :family_id=>nil,
:controller=>"people"}, expected: {:action=>"index",
:controller=>"people"}, diff:
{:family_id=>nil}
Comments and changes to this ticket
- 
         José Valim March 26th, 2010 @ 11:05 PM- Assigned user set to josh
- Milestone cleared.
 
- 
         Rizwan Reza March 26th, 2010 @ 11:14 PM- Milestone set to 2.3.6
 José, I am not sure this relates to 3.0, since his example shows map.resources ....
- 
         
- 
            
         
- 
         Santiago Pastorino April 6th, 2010 @ 09:13 PM- State changed from new to open
 I've added a failing test here http://github.com/spastorino/rails/commit/3f16c0fde9aaf56570ddbf4c6... 
- 
         
- 
         Repository April 7th, 2010 @ 05:29 AM- State changed from open to committed
 (from [cfb31edb5441f0b12693a3b509dadf87fe1df843]) Generate routes for nested resources with nil object raise RoutingError [#4262 state:committed] Signed-off-by: Jeremy Kemper jeremy@bitsweat.net 
 http://github.com/rails/rails/commit/cfb31edb5441f0b12693a3b509dadf...
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>
People watching this ticket
Referenced by
- 
         4262 
          Generate routes for nested resources with nil object
        (from [cfb31edb5441f0b12693a3b509dadf87fe1df843])
Generat... 4262 
          Generate routes for nested resources with nil object
        (from [cfb31edb5441f0b12693a3b509dadf87fe1df843])
Generat...
 Anil Wadghule
      Anil Wadghule
 Bounga
      Bounga
 fuse
      fuse
 José Valim
      José Valim
 Rizwan Reza
      Rizwan Reza
 Santiago Pastorino
      Santiago Pastorino