#dup array_of_attributes a bit earlier - there's no point in duping the primary_key nulls we might put in next

This commit is contained in:
Ben Woosley 2010-11-16 23:56:57 -08:00 committed by Zach Dennis
parent 899af1e412
commit 876546c584

View file

@ -180,6 +180,9 @@ class ActiveRecord::Base
raise ArgumentError.new( "Invalid arguments!" ) raise ArgumentError.new( "Invalid arguments!" )
end end
# dup the passed in array so we don't modify it unintentionally
array_of_attributes = array_of_attributes.dup
# Force the primary key col into the insert if it's not # Force the primary key col into the insert if it's not
# on the list and we are using a sequence and stuff a nil # on the list and we are using a sequence and stuff a nil
# value for it into each row so the sequencer will fire later # value for it into each row so the sequencer will fire later
@ -188,9 +191,6 @@ class ActiveRecord::Base
array_of_attributes.each { |a| a << nil } array_of_attributes.each { |a| a << nil }
end end
# dup the passed in array so we don't modify it unintentionally
array_of_attributes = array_of_attributes.dup
# record timestamps unless disabled in ActiveRecord::Base # record timestamps unless disabled in ActiveRecord::Base
if record_timestamps && options.delete( :timestamps ) if record_timestamps && options.delete( :timestamps )
add_special_rails_stamps column_names, array_of_attributes, options add_special_rails_stamps column_names, array_of_attributes, options