-
Dmytro Savochkin authored
Fix #46363. Currently calling `reload` re-calculates the association cache based on the object freshly loaded from the database. The fresh object gets assigned as `owner` for each association in the association cache. That object however is not the same as `self` (even though they both point to the same record). Under some specific circumstances (using `has_one/has_many through` associations and transactions with `after_commit` callbacks) this might lead to losing the effects of assignments done inside the callback. This commit fixes it by making `reload` point to `self` as `owner` for each association in the association cache.
Dmytro Savochkin authoredFix #46363. Currently calling `reload` re-calculates the association cache based on the object freshly loaded from the database. The fresh object gets assigned as `owner` for each association in the association cache. That object however is not the same as `self` (even though they both point to the same record). Under some specific circumstances (using `has_one/has_many through` associations and transactions with `after_commit` callbacks) this might lead to losing the effects of assignments done inside the callback. This commit fixes it by making `reload` point to `self` as `owner` for each association in the association cache.
Loading