Permalink
Browse files

Avoid Symbol#to_proc for performance reasons in Ruby 1.8

  • Loading branch information...
jonleighton authored and tenderlove committed Dec 20, 2010
1 parent 834e533 commit 37b67df7e47966c88eaf5c6ed8c5286df69d20b9
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/associations/has_many_association.rb
@@ -62,12 +62,12 @@ def insert_record(record, force = false, validate = true)
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)

0 comments on commit 37b67df

Please sign in to comment.