We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05a90c3 commit 34db2b7Copy full SHA for 34db2b7
activerecord/lib/active_record/associations/has_many_association.rb
@@ -121,13 +121,11 @@ def delete_or_nullify_all_records(method)
121
# Deletes the records according to the <tt>:dependent</tt> option.
122
def delete_records(records, method)
123
if method == :destroy
124
- count = records.length
125
records.each(&:destroy!)
126
- update_counter(-count) unless inverse_updates_counter_cache?
+ update_counter(-records.length) unless inverse_updates_counter_cache?
127
else
128
scope = self.scope.where(reflection.klass.primary_key => records)
129
- count = delete_count(method, scope)
130
- update_counter(-count)
+ update_counter(-delete_count(method, scope))
131
end
132
133
0 commit comments