module ActiveRecord::ConnectionAdapters::ColumnMethods
Public Instance Methods
column(name, type, **options) Show source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 216 included do define_column_methods :bigint, :binary, :boolean, :date, :datetime, :decimal, :float, :integer, :json, :string, :text, :time, :timestamp, :virtual alias :numeric :decimal end
Appends a column or columns of a specified type.
t.string(:goat) t.string(:goat, :sheep)
See ActiveRecord::ConnectionAdapters::TableDefinition#column
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 201 def primary_key(name, type = :primary_key, **options) column(name, type, options.merge(primary_key: true)) end
Appends a primary key definition to the table definition. Can be called multiple times, but this is probably not a good idea.
© 2004–2019 David Heinemeier Hansson
Licensed under the MIT License.