aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2014-05-13 20:55:36 -0400
committereileencodes <eileencodes@gmail.com>2014-05-13 21:01:28 -0400
commit34db2b7caacefac2dd808b52a7f77d58ff6a8b69 (patch)
tree6c734d03173bb5b85d103202d4af40b4667e29bd /activerecord
parent05a90c36c55fe0e43d60c2d0aa09d7a16ddd34ee (diff)
downloadrails-34db2b7caacefac2dd808b52a7f77d58ff6a8b69.tar.gz
rails-34db2b7caacefac2dd808b52a7f77d58ff6a8b69.tar.bz2
rails-34db2b7caacefac2dd808b52a7f77d58ff6a8b69.zip
remove count var
this change was unneccsary as nothing was gained from it
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/has_many_association.rb6
1 files changed, 2 insertions, 4 deletions
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 <tt>:dependent</tt> 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