Module: ActiveModelPersistence::PrimaryKey
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Attributes, ActiveModel::Model
- Included in:
- Indexable, Persistence, PrimaryKeyIndex
- Defined in:
- lib/active_model_persistence/primary_key.rb
Overview
Exposes the `primary_key` accessor to read or write the primary key attribute value
The primary key should be a unique (within its model class) identifier for a model.
By default, the `primary_key` accessors maps to the `id` attribute. You can change the attribute by setting the `primary_key` at the class level.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#primary_key ⇒ String
Identifies the attribute that the `primary_key_value` accessor maps to.
Instance Attribute Details
#primary_key ⇒ String
Identifies the attribute that the `primary_key_value` accessor maps to
The primary key is 'id' by default.
|
# File 'lib/active_model_persistence/primary_key.rb', line 47
|