php-activerecord
php-activerecord copied to clipboard
Potential fix for issue #546
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.
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 :)