Method: Mongoid::Dirty::InstanceMethods#attribute_was
- Defined in:
- lib/mongoid/dirty.rb
#attribute_was(name) ⇒ Object
Gets the old value for a specific field.
Example:
person = Person.new(:title => "Sir")
person.title = "Madam"
person.attribute_was("title") # "Sir"
Returns:
The old field value.
47 48 49 50 |
# File 'lib/mongoid/dirty.rb', line 47 def attribute_was(name) change = modifications[name] change ? change[0] : nil end |