aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-03-09 20:55:14 +0000
committerJamis Buck <jamis@37signals.com>2006-03-09 20:55:14 +0000
commit966c276d6071f8c331f75820f8c2f30d1bba02b2 (patch)
treeeddee6d6d95ae7656785a95e12a3e3cc8f528859 /activerecord/lib/active_record/associations
parent532f9d484cb222b452c059d8e1088910fc404a25 (diff)
downloadrails-966c276d6071f8c331f75820f8c2f30d1bba02b2.tar.gz
rails-966c276d6071f8c331f75820f8c2f30d1bba02b2.tar.bz2
rails-966c276d6071f8c331f75820f8c2f30d1bba02b2.zip
Fix counter cache setting in belongs-to proxy
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3828 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/belongs_to_association.rb2
1 files changed, 1 insertions, 1 deletions
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