method

raise_on_if_exist_options

Importance_0
v7.1.3.2 - Show latest stable - 0 notes - Class: Table
raise_on_if_exist_options(options) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# 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
Register or log in to add new notes.