instance method raise_on_if_exist_options

Ruby on Rails 8.1.2

Since v7.1.6 Private

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

raise_on_if_exist_options(options)

No documentation comment.

Parameters

options req
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 946
        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

Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 946 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::Table

Type at least 2 characters to search.

↑↓ navigate · open · esc close