aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-06-13 10:59:11 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-06-13 10:59:11 -0700
commit634fd040dbabf3e268a6a4bf4a9136468222022f (patch)
treee11c5c163712352527626319cd51077e3ffa9861 /activerecord/lib/active_record/reflection.rb
parent9abcb131f94786dbe273088ebd0d93444ca298b2 (diff)
downloadrails-634fd040dbabf3e268a6a4bf4a9136468222022f.tar.gz
rails-634fd040dbabf3e268a6a4bf4a9136468222022f.tar.bz2
rails-634fd040dbabf3e268a6a4bf4a9136468222022f.zip
let the object stay in charge of internal cache invalidation
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r--activerecord/lib/active_record/reflection.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 76eeae3160..72a05f12aa 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -123,6 +123,11 @@ module ActiveRecord
name.to_s.pluralize : name.to_s
end
+ def autosave=(autosave)
+ @automatic_inverse_of = false
+ @options[:autosave] = autosave
+ end
+
# Returns the class for the macro.
#
# <tt>composed_of :balance, class_name: 'Money'</tt> returns the Money class
@@ -312,13 +317,6 @@ module ActiveRecord
@inverse_of = nil
end
- # Removes the cached inverse association that was found automatically
- # and prevents this object from finding the inverse association
- # automatically in the future.
- def remove_automatic_inverse_of!
- @automatic_inverse_of = false
- end
-
def polymorphic_inverse_of(associated_class)
if has_inverse?
if inverse_relationship = associated_class.reflect_on_association(options[:inverse_of])