aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-06-13 15:36:25 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-06-13 15:36:50 -0700
commit8f37ba81abbd13b935ce0f26574ff2b720b552f1 (patch)
tree9f146f8abea0739c942880e8a526d770e5bf693a /activerecord/lib/active_record/reflection.rb
parent934369f529699e65b57565189ae2d3f6f733ff11 (diff)
downloadrails-8f37ba81abbd13b935ce0f26574ff2b720b552f1.tar.gz
rails-8f37ba81abbd13b935ce0f26574ff2b720b552f1.tar.bz2
rails-8f37ba81abbd13b935ce0f26574ff2b720b552f1.zip
This test does not test anything that happens in the real world. If you
recreate the models without mucking with internal caches of the relation objects, then the test fails. For example: class Man < ActiveRecord::Base has_many :interests end class Interest < ActiveRecord::Base belongs_to :man end Then do this test: def test_validate_presence_of_parent_fails_without_inverse_of repair_validations(Interest) do Interest.validates_presence_of(:man) assert_no_difference ['Man.count', 'Interest.count'] do man = Man.create(:name => 'John', :interests_attributes => [{:topic=>'Cars'}, {:topic=>'Sports'}]) assert_not_predicate man.errors[:"interests.man"], :empty? end end end The test will fail. This is a bad test, so I am removing it.
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r--activerecord/lib/active_record/reflection.rb7
1 files changed, 0 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index cfae2ffdb5..1335af9e39 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -310,13 +310,6 @@ module ActiveRecord
@inverse_of ||= klass.reflect_on_association inverse_name
end
- # Clears the cached value of +@inverse_of+ on this object. This will
- # not remove the :inverse_of option however, so future calls on the
- # +inverse_of+ will have to recompute the inverse.
- def clear_inverse_of_cache!
- @inverse_of = nil
- end
-
def polymorphic_inverse_of(associated_class)
if has_inverse?
if inverse_relationship = associated_class.reflect_on_association(options[:inverse_of])