instance method
column_exists?
Ruby on Rails 7.1.6
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 -
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 735
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 735
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::Table