diff --git a/lib/activerecord-import/import.rb b/lib/activerecord-import/import.rb index aa75d9aa..b7875f95 100644 --- a/lib/activerecord-import/import.rb +++ b/lib/activerecord-import/import.rb @@ -703,7 +703,8 @@ def import_helper( *args ) # keep track of the instance and the position it is currently at. if this fails # validation we'll use the index to remove it from the array_of_attributes arr.each_with_index do |hsh, i| - model = new(hsh) + model = new + hsh.each_pair { |k, v| model[k] = v } next if validator.valid_model?(model) raise(ActiveRecord::RecordInvalid, model) if options[:raise_error] array_of_attributes[i] = nil