Method: Norman::Model::InstanceMethods#to_id
- Defined in:
- lib/norman/model.rb
#to_id(use_old = false) ⇒ Object
Invoke the model’s id method to return this instance’s unique key. If true is passed, then the id will be read from the attributes hash rather than from an instance variable. This allows you to retrieve the old id, in the event that the id has been changed.
140 141 142 |
# File 'lib/norman/model.rb', line 140 def to_id(use_old = false) use_old ? @attributes[self.class.id_method] : send(self.class.id_method) end |