781ecc22eb
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.
9 lines
209 B
Ruby
9 lines
209 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Editor < ActiveRecord::Base
|
|
self.primary_key = "name"
|
|
|
|
has_one :publication, foreign_key: :editor_in_chief_id, inverse_of: :editor_in_chief
|
|
has_many :editorships
|
|
end
|