From 9727a043627e34f7065bfaca1931129b3c6a7b72 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Wed, 17 Nov 2010 00:22:23 -0800 Subject: [PATCH] Reinstate the deleting of the :validate option - not because it was causing trouble, but to be a bit paranoid (reverts 63d6faeccee14b6e571a25b6f51f340d5da325f5) --- lib/activerecord-import/import.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/activerecord-import/import.rb b/lib/activerecord-import/import.rb index 89bd010..5f674a5 100644 --- a/lib/activerecord-import/import.rb +++ b/lib/activerecord-import/import.rb @@ -157,7 +157,9 @@ class ActiveRecord::Base def import( *args ) options = { :validate=>true, :timestamps=>true } options.merge!( args.pop ) if args.last.is_a? Hash - + + is_validating = options.delete( :validate ) + # assume array of model objects if args.last.is_a?( Array ) and args.last.first.is_a? ActiveRecord::Base if args.length == 2 @@ -199,7 +201,7 @@ class ActiveRecord::Base add_special_rails_stamps column_names, array_of_attributes, options end - return_obj = if options[:validate] + return_obj = if is_validating import_with_validations( column_names, array_of_attributes, options ) else num_inserts = import_without_validations_or_callbacks( column_names, array_of_attributes, options )