From 13af342c34e04a8e526c4bd11bbe4f5270e7f8fa Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 7 Oct 2016 18:26:45 +0200 Subject: explain why autosave= disables inverse_of [ci skip] --- activerecord/lib/active_record/reflection.rb | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.3