instance method
to_key
Ruby on Rails 3.0.20
Since v3.0.20Signature
to_key()
Returns this record’s primary key value wrapped in an Array or nil if the record is a new_record?
Source
# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 8
def to_key
new_record? ? nil : [ id ]
end
Defined in activerecord/lib/active_record/attribute_methods/primary_key.rb line 8
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::PrimaryKey