diff options
author | Eugene Kenny <elkenny@gmail.com> | 2018-03-24 22:18:05 +0000 |
---|---|---|
committer | Eugene Kenny <elkenny@gmail.com> | 2018-03-24 22:18:05 +0000 |
commit | 0cdeda5826fc7cf26de404dcdd6d747531a32b6c (patch) | |
tree | e0f7b0ed61048c76a9e216177f43b50290cbe678 /activerecord/lib/active_record/define_callbacks.rb | |
parent | ff6d498704cff88b823871d20c5dfcaa3345ead7 (diff) | |
download | rails-0cdeda5826fc7cf26de404dcdd6d747531a32b6c.tar.gz rails-0cdeda5826fc7cf26de404dcdd6d747531a32b6c.tar.bz2 rails-0cdeda5826fc7cf26de404dcdd6d747531a32b6c.zip |
Don't unset foreign key when preloading missing record
When a belongs to association's target is set, its foreign key is now
updated to match the new target. This is the correct behaviour when a
new record is assigned, but not when the existing record is preloaded.
As long as we mark the association as loaded, we can skip setting the
target when the record is missing and avoid clobbering the foreign key.
Diffstat (limited to 'activerecord/lib/active_record/define_callbacks.rb')
0 files changed, 0 insertions, 0 deletions