instance method
to_key
Ruby on Rails 3.2.22.5
Since v3.0.20Signature
to_key()
Returns an Enumerable of all key attributes if any is set, regardless if the object is persisted or not.
Note the default implementation uses persisted? just because all objects in Ruby 1.8.x responds to :id.
Source
# File activemodel/lib/active_model/conversion.rb, line 45
def to_key
persisted? ? [id] : nil
end
Defined in activemodel/lib/active_model/conversion.rb line 45
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Conversion