1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use accessors internally; remove needless validation

This commit is contained in:
Kasper Timm Hansen 2019-03-31 20:17:57 +02:00
parent 2ea8bfd040
commit 6bc02140a3
No known key found for this signature in database
GPG key ID: 191153215EDA53D8

View file

@ -73,15 +73,11 @@ module ActiveRecord
raise ArgumentError, "#{connection.class} does not support :returning"
end
unless %i{ raise skip update }.member?(on_duplicate)
raise NotImplementedError, "#{on_duplicate.inspect} is an unknown value for :on_duplicate. Valid values are :raise, :skip, and :update"
end
if on_duplicate == :skip && !connection.supports_insert_on_duplicate_skip?
if skip_duplicates? && !connection.supports_insert_on_duplicate_skip?
raise ArgumentError, "#{connection.class} does not support skipping duplicates"
end
if on_duplicate == :update && !connection.supports_insert_on_duplicate_update?
if update_duplicates? && !connection.supports_insert_on_duplicate_update?
raise ArgumentError, "#{connection.class} does not support upsert"
end