diff options
author | Gabe da Silveira <gabe@websaviour.com> | 2009-08-09 13:16:57 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-09 21:18:16 -0700 |
commit | 7e3364ac4634f7017305c4bc725710ab0e7ba4c2 (patch) | |
tree | a8a074d7d28a408e9d0ab9cdc624fd7802120901 /activerecord/lib/active_record | |
parent | 5704ecffadffa04981ec5999c362cb691d4a676e (diff) | |
download | rails-7e3364ac4634f7017305c4bc725710ab0e7ba4c2.tar.gz rails-7e3364ac4634f7017305c4bc725710ab0e7ba4c2.tar.bz2 rails-7e3364ac4634f7017305c4bc725710ab0e7ba4c2.zip |
Fix that counter_cache breaks with has_many :dependent => :nullify.
[#1196 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index e4b631bc54..73d3c23cd3 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -74,6 +74,7 @@ module ActiveRecord "#{@reflection.primary_key_name} = NULL", "#{@reflection.primary_key_name} = #{owner_quoted_id} AND #{@reflection.klass.primary_key} IN (#{ids})" ) + @owner.class.update_counters(@owner.id, cached_counter_attribute_name => -records.size) if has_cached_counter? end end |