aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-12-20 21:53:11 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-20 13:56:04 -0800
commit37b67df7e47966c88eaf5c6ed8c5286df69d20b9 (patch)
treea8c54d0a48a97e13e74a199e43d0f611621be449 /activerecord
parent834e5336a5d8a8250251e756385e39ebfb4917c3 (diff)
downloadrails-37b67df7e47966c88eaf5c6ed8c5286df69d20b9.tar.gz
rails-37b67df7e47966c88eaf5c6ed8c5286df69d20b9.tar.bz2
rails-37b67df7e47966c88eaf5c6ed8c5286df69d20b9.zip
Avoid Symbol#to_proc for performance reasons in Ruby 1.8
Diffstat (limited to 'activerecord')
-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)