module ActiveModel::Conversion
def to_key
Note the default implementation uses persisted? just because all objects
if the object is persisted or not.
Returns an Enumerable of all key attributes if any is set, regardless
def to_key persisted? ? [id] : nil end
def to_model
define :to_model yourself returning a proxy object that wraps
If your model does not act like an Active Model object, then you should
self.
you can use the default to_model implementation, which simply returns
If your object is already designed to implement all of the Active Model
def to_model self end
def to_param
Returns a string representing the object's key suitable for use in URLs,
def to_param persisted? ? to_key.join('-') : nil end