method
raise_on_if_exist_options
rails latest stable - Class:
ActiveRecord::ConnectionAdapters::ColumnMethods::Table
raise_on_if_exist_options(options)private
No documentation available.
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 945
def raise_on_if_exist_options(options)
unrecognized_option = options.keys.find do |key|
key == :if_exists || key == :if_not_exists
end
if unrecognized_option
conditional = unrecognized_option == :if_exists ? "if" : "unless"
message = <<~TXT
Option #{unrecognized_option} will be ignored. If you are calling an expression like
`t.column(.., #{unrecognized_option}: true)` from inside a change_table block, try a
conditional clause instead, as in `t.column(..) #{conditional} t.column_exists?(..)`
TXT
raise ArgumentError.new(message)
end
end