vendredi 31 juillet 2015

Limit to nested forms with accepts_nested_attributes_for

I have a registration form that creates a User and, via nested forms, needs to work as follows:

Users have Events

Events have EventSessions

EventSessions have a Location

Rails allows me to update as far down as EventSessions because the User model contains: has_many :little_class_sessions, through: :little_classes.

I'm unable to save to Location because it's nested under EventSessions. That's one level too deep for rails, and it throws an exception.

What would be the most correct way to create the Location and update the EventSession with the location_id? Inside the UserController?

Aucun commentaire:

Enregistrer un commentaire