From 876546c584a6956c87912108a1094514b705790a Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Tue, 16 Nov 2010 23:56:57 -0800 Subject: [PATCH] #dup array_of_attributes a bit earlier - there's no point in duping the primary_key nulls we might put in next --- lib/activerecord-import/import.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/activerecord-import/import.rb b/lib/activerecord-import/import.rb index 73f1ffd..35bb026 100644 --- a/lib/activerecord-import/import.rb +++ b/lib/activerecord-import/import.rb @@ -180,6 +180,9 @@ class ActiveRecord::Base raise ArgumentError.new( "Invalid arguments!" ) 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 # 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 @@ -188,9 +191,6 @@ class ActiveRecord::Base array_of_attributes.each { |a| a << nil } 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 if record_timestamps && options.delete( :timestamps ) add_special_rails_stamps column_names, array_of_attributes, options