instance method
to_key
Ruby on Rails 4.0.13
Since v3.0.20Signature
to_key()
Returns this record’s primary key value wrapped in an Array if one is available.
Source
# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 10
def to_key
sync_with_transaction_state
key = self.id
[key] if key
end
Defined in activerecord/lib/active_record/attribute_methods/primary_key.rb line 10
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::PrimaryKey