aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-10-07 18:29:33 +0200
committerGitHub <noreply@github.com>2016-10-07 18:29:33 +0200
commitf94a14d2c265982713248dd742ca75b33f458fb1 (patch)
treefd5b30c238d563d5711eab6e166c8e05abf97bdd
parentfc0b62597f9c34bd028fd91457b8865eea42cc2d (diff)
parent13af342c34e04a8e526c4bd11bbe4f5270e7f8fa (diff)
downloadrails-f94a14d2c265982713248dd742ca75b33f458fb1.tar.gz
rails-f94a14d2c265982713248dd742ca75b33f458fb1.tar.bz2
rails-f94a14d2c265982713248dd742ca75b33f458fb1.zip
Merge pull request #26730 from rails/explain-why-inverse_of-is-disabled
explain why autosave= disables inverse_of [ci skip]
-rw-r--r--activerecord/lib/active_record/reflection.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 9b692f55d2..57020e00c9 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -282,6 +282,10 @@ module ActiveRecord
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