Don't initialize options[:on_duplicate_key_update] if the adapter doesn't #supports_on_duplicate_key_update?

This commit is contained in:
Ben Woosley 2010-11-16 23:03:30 -08:00 committed by Zach Dennis
parent b3dda82c10
commit fff00af942

View file

@ -323,6 +323,7 @@ class ActiveRecord::Base
array_of_attributes.each { |arr| arr << value } array_of_attributes.each { |arr| arr << value }
end end
if supports_on_duplicate_key_update?
if options[:on_duplicate_key_update] if options[:on_duplicate_key_update]
options[:on_duplicate_key_update] << key.to_sym if options[:on_duplicate_key_update].is_a?(Array) options[:on_duplicate_key_update] << key.to_sym if options[:on_duplicate_key_update].is_a?(Array)
options[:on_duplicate_key_update][key.to_sym] = key.to_sym if options[:on_duplicate_key_update].is_a?(Hash) options[:on_duplicate_key_update][key.to_sym] = key.to_sym if options[:on_duplicate_key_update].is_a?(Hash)
@ -332,6 +333,7 @@ class ActiveRecord::Base
end end
end end
end end
end
# Returns an Array of Hashes for the passed in +column_names+ and +array_of_attributes+. # Returns an Array of Hashes for the passed in +column_names+ and +array_of_attributes+.
def validations_array_for_column_names_and_attributes( column_names, array_of_attributes ) # :nodoc: def validations_array_for_column_names_and_attributes( column_names, array_of_attributes ) # :nodoc: