I have a
:user has_many :events has_many :signups
map.resources :users do |user|
user.resources :events do |event|
event.resources :signups
end
end
But in the 3rd nested resource im having trouble with the form_for( )
function.
The link to the page where the form lies works and i linked to it
with: new_user_event_signup_path(@user, @event) but the page
doesnt render with anything i have tried, and i have tried…!
so far ive tried:
form_for([@user, @signup])
form_for([@user, @event])
form_for([@event, @signup])
and everything in between…
oh, and i have tried all variations of 3 instances aswell… such as
form_for([@user, @event, @signup])
3 levels deep nesting is not nessessary, as the event as parent to the
signup is enough to keep a unique scope on the signup object.
- use these routes:
map.resources :users do |user|
user.resources :events
end
map.resources :events do |event|
event.resources :signups
end
- and this form defintion:
form_for([@event, @signup])
and everything is fine.
Also, you might want to check Jamis B.'s post on why 3 deep nested
resources may not be a good practice.
http://weblog.jamisbuck.org/2007/2/5/nesting-resources