Flowdock
method

to_key

Importance_1
Ruby on Rails latest stable (v4.2.1) - 0 notes - Class: ActiveModel::Conversion
to_key() public

Returns an Array of all key attributes if any is set, regardless if the object is persisted or not. Returns nil if there are no key attributes.

class Person
  include ActiveModel::Conversion
  attr_accessor :id
end

person = Person.create(id: 1)
person.to_key # => [1]
Show source
Register or log in to add new notes.