module ActiveModel::Conversion

def to_key

in Ruby 1.8.x responds to :id.
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