модуль ActiveRecord::ConnectionAdapters::ColumnMethods
Публичные методы экземпляра
column(name, type, **options) Показать исходный код
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 248
included do
define_column_methods :bigint, :binary, :boolean, :date, :datetime, :decimal,
:float, :integer, :json, :string, :text, :time, :timestamp, :virtual
alias :numeric :decimal
end Добавляет столбец или столбцы указанного типа.
t.string(:goat) t.string(:goat, :sheep)
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 233 def primary_key(name, type = :primary_key, **options) column(name, type, **options.merge(primary_key: true)) end
Добавляет определение первичного ключа к определению таблицы. Можно вызывать несколько раз, но это, вероятно, не хорошая идея.
© 2004–2020 David Heinemeier Hansson
Licensed under the MIT License.