From 34db2b7caacefac2dd808b52a7f77d58ff6a8b69 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Tue, 13 May 2014 20:55:36 -0400 Subject: remove count var this change was unneccsary as nothing was gained from it --- activerecord/lib/active_record/associations/has_many_association.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 4a7d8ed74a..f5e911c739 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -121,13 +121,11 @@ module ActiveRecord # Deletes the records according to the :dependent option. def delete_records(records, method) if method == :destroy - count = records.length records.each(&:destroy!) - update_counter(-count) unless inverse_updates_counter_cache? + update_counter(-records.length) unless inverse_updates_counter_cache? else scope = self.scope.where(reflection.klass.primary_key => records) - count = delete_count(method, scope) - update_counter(-count) + update_counter(-delete_count(method, scope)) end end -- cgit v1.2.3