Reinstate the deleting of the :validate option - not because it was causing trouble, but to be a bit paranoid (reverts 63d6faeccee14b6e571a25b6f51f340d5da325f5)
This commit is contained in:
parent
a3e9b4f040
commit
9727a04362
|
@ -157,7 +157,9 @@ class ActiveRecord::Base
|
||||||
def import( *args )
|
def import( *args )
|
||||||
options = { :validate=>true, :timestamps=>true }
|
options = { :validate=>true, :timestamps=>true }
|
||||||
options.merge!( args.pop ) if args.last.is_a? Hash
|
options.merge!( args.pop ) if args.last.is_a? Hash
|
||||||
|
|
||||||
|
is_validating = options.delete( :validate )
|
||||||
|
|
||||||
# assume array of model objects
|
# assume array of model objects
|
||||||
if args.last.is_a?( Array ) and args.last.first.is_a? ActiveRecord::Base
|
if args.last.is_a?( Array ) and args.last.first.is_a? ActiveRecord::Base
|
||||||
if args.length == 2
|
if args.length == 2
|
||||||
|
@ -199,7 +201,7 @@ class ActiveRecord::Base
|
||||||
add_special_rails_stamps column_names, array_of_attributes, options
|
add_special_rails_stamps column_names, array_of_attributes, options
|
||||||
end
|
end
|
||||||
|
|
||||||
return_obj = if options[:validate]
|
return_obj = if is_validating
|
||||||
import_with_validations( column_names, array_of_attributes, options )
|
import_with_validations( column_names, array_of_attributes, options )
|
||||||
else
|
else
|
||||||
num_inserts = import_without_validations_or_callbacks( column_names, array_of_attributes, options )
|
num_inserts = import_without_validations_or_callbacks( column_names, array_of_attributes, options )
|
||||||
|
|
Loading…
Reference in a new issue