aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/associations/has_many_association.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb
index 2e99177af4..4b05cf6e81 100644
--- a/activerecord/lib/active_record/associations/has_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_association.rb
@@ -62,12 +62,12 @@ module ActiveRecord
def delete_records(records)
case @reflection.options[:dependent]
when :destroy
- records.each(&:destroy)
+ records.each { |r| r.destroy }
when :delete_all
- @reflection.klass.delete(records.map(&:id))
+ @reflection.klass.delete(records.map { |r| r.id })
else
updates = { @reflection.primary_key_name => nil }
- conditions = { @reflection.association_primary_key => records.map(&:id) }
+ conditions = { @reflection.association_primary_key => records.map { |r| r.id } }
with_scope(@scope) do
@reflection.klass.update_all(updates, conditions)