提交 966c276d 编写于 作者: J Jamis Buck

Fix counter cache setting in belongs-to proxy


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3828 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 532f9d48
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册