To avoid foreign key errors (and invalid data) in the database, when a belongs_to association is destroyed, it should also be nil'd out on the parent object.
That is, the association id should not be kept on the record after save. This is a corruption of data integrity in the database.
Unset association when existing record is destroyed.
I probably missed something, but isn't this the same as using :dependent => :nullify on the other side of the association (has_many, has_one)?
:dependent => :nullify
This is the pull request that fixes #5235, right?
@steveklabnik It is.
@isabanin Sorry I didn't respond, I didn't have a chance to test :dependent => :nullify. But I don't think that workaround invalidates the bug/pull request. That is, if you destroy a belongs_to through the association, then the association should be unset. Otherwise you have invalid data being persisted. That should just be default behavior--there shouldn't be a need to have a special option (I don't think the two are equivalent anyway.)
@jonleighton @tenderlove any thoughts on this?