php-activerecord icon indicating copy to clipboard operation
php-activerecord copied to clipboard

Potential fix for issue #546

Open louismrose opened this issue 9 years ago • 1 comments

As discussed in #546, I was seeing an issue whereby foreign key attributes where not being set during a create_association for a belongs_to.

This is one potential fix: it overrides the append_record_to_associate (which was shared for all types of relationship) for belongs to relationships such that the foreign key is set on the associate, and not on the new record.

louismrose avatar Jul 05 '16 16:07 louismrose

I think your fix is fine, although still strange to create the owner from the associate. Like children creating their parents. And that all the tests still pass amazes me :)

koenpunt avatar Jul 09 '16 10:07 koenpunt