This project is archived and is in readonly mode.

#4262 ✓committed
fuse

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

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