aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-06-25 10:56:20 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-06-25 10:56:20 +0000
commitdeda0ee4a8008475629f020e0334f64cc05215c8 (patch)
treee41d89732885455334c5565488f3bfce2bc6085f /activerecord/lib/active_record/associations.rb
parente4ccbf28c815fefeeb90c45524feea7b57e5a6ae (diff)
downloadrails-deda0ee4a8008475629f020e0334f64cc05215c8.tar.gz
rails-deda0ee4a8008475629f020e0334f64cc05215c8.tar.bz2
rails-deda0ee4a8008475629f020e0334f64cc05215c8.zip
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
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb2
1 files changed, 1 insertions, 1 deletions
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