From 966c276d6071f8c331f75820f8c2f30d1bba02b2 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 9 Mar 2006 20:55:14 +0000 Subject: Fix counter cache setting in belongs-to proxy git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3828 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations/belongs_to_association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 3e0e0d0fb9..8955c0dc31 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -21,7 +21,7 @@ module ActiveRecord else raise_on_type_mismatch(record) - if counter_cache_name && @owner[counter_cache_name] && !@owner.new_record? + if counter_cache_name && !@owner.new_record? @reflection.klass.increment_counter(counter_cache_name, record.id) @reflection.klass.decrement_counter(counter_cache_name, @owner[@reflection.primary_key_name]) if @owner[@reflection.primary_key_name] end -- cgit v1.2.3