instance method
column_exists?
Ruby on Rails 5.2.8.1
Since v3.0.20Signature
column_exists?(column_name, type = nil, options = {})
Checks to see if a column exists.
t.string(:name) unless t.column_exists?(:name, :string)
Parameters
-
column_namereq -
typeopt = nil -
optionsopt = {}
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 535
def column_exists?(column_name, type = nil, options = {})
@base.column_exists?(name, column_name, type, options)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 535
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::Table