When using shallow routes, different routes require different form_for arguments

If the first object in the array you pass the form builder is nil, Rails will POST to the second object only. For this reason simply don’t set your @customer object in your controller’s edit action. If you need access to the customer object, call it through @note.

If you’re using the same partial for new and edit, you’ll want to set @note.customer in the controller’s new action (@customer won’t be set when editing).

I think this is how the Rails team intended it to work.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)