instance method
primary_key
Ruby on Rails 4.1.16
Since v2.2.3 Last seen in v4.2.9Signature
primary_key(name, type = :primary_key, options = {})
Appends a primary key definition to the table definition. Can be called multiple times, but this is probably not a good idea.
Parameters
-
namereq -
typeopt = :primary_key -
optionsopt = {}
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 68
def primary_key(name, type = :primary_key, options = {})
column(name, type, options.merge(:primary_key => true))
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 68
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::TableDefinition