ActiveRecord::ConnectionAdapters::ColumnMethods

module ActiveRecord::ConnectionAdapters::ColumnMethods

Public Instance Methods

primary_key(name, type = :primary_key, **options) Show source

Appends a primary key definition to the table definition. Can be called multiple times, but this is probably not a good idea.

# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 161
def primary_key(name, type = :primary_key, **options)
  column(name, type, options.merge(primary_key: true))
end

© 2004–2017 David Heinemeier Hansson
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部