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.