From deda0ee4a8008475629f020e0334f64cc05215c8 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 25 Jun 2005 10:56:20 +0000 Subject: Fixed that clear_association_cache doesn't delete new associations on new records (so you can safely place new records in the session with Action Pack without having new associations wiped) #1494 [cluon] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1504 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index fffafb2a29..3fbe252144 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -17,7 +17,7 @@ module ActiveRecord def clear_association_cache #:nodoc: self.class.reflect_on_all_associations.to_a.each do |assoc| instance_variable_set "@#{assoc.name}", nil - end + end unless self.new_record? end # Associations are a set of macro-like class methods for tying objects together through foreign keys. They express relationships like -- cgit v1.2.3