I'm willing to write a patch for this issue:
https://github.com/rails/rails/issues/8893

But want to confirm that the new behavior makes sense before I make the 
effort.

Essentially if you have an unsaved parent and child, and the parent's 
association to the child has an inverse_of declared on it.  When the parent 
gets saved, it updates the foreign key on the child, and this makes the 
association stale, breaking the inverse_of connection.

It should be pretty easy to fix.  Either on the parent's side by checking 
to see if the association we're setting the foreign key on has an 
inverse_of on it, and if so, declare the inverse association as loaded. 
 Or, probably better than that, on the child, if you think an association 
is stale because your foreign key to it has changed, double check to see if 
the id of your existing model matches the new foreign key.

Does that sound like a reasonable change to make?

Thanks,
Joseph Palermo
Pivotal Labs

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to