Permalink
Browse files

Fix counter cache setting in belongs-to proxy

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3828 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
jamis committed Mar 9, 2006
1 parent 532f9d4 commit 966c276d6071f8c331f75820f8c2f30d1bba02b2
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/associations/belongs_to_association.rb
@@ -21,7 +21,7 @@ def replace(record)
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

0 comments on commit 966c276

Please sign in to comment.