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,11 +323,13 @@ class ActiveRecord::Base
array_of_attributes.each { |arr| arr << value } array_of_attributes.each { |arr| arr << value }
end end
if options[:on_duplicate_key_update] if supports_on_duplicate_key_update?
options[:on_duplicate_key_update] << key.to_sym if options[:on_duplicate_key_update].is_a?(Array) if options[:on_duplicate_key_update]
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 if options[:on_duplicate_key_update].is_a?(Array)
else 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 ] else
options[:on_duplicate_key_update] = [ key.to_sym ]
end
end end
end end
end end