Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explain why autosave= disables inverse_of [ci skip] #26730

Merged
merged 1 commit into from Oct 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions activerecord/lib/active_record/reflection.rb
Expand Up @@ -282,6 +282,10 @@ def initialize(name, scope, options, active_record)
end

def autosave=(autosave)
# autosave and inverse_of do not get along together nowadays. They may
# for example cause double saves. Thus, we disable this flag. If in the
# future those two flags are known to work well together, this could be
# removed.
@automatic_inverse_of = false
@options[:autosave] = autosave
parent_reflection = self.parent_reflection
Expand Down