Method: Mongoid::Dirty::InstanceMethods#attribute_change

Defined in:
lib/mongoid/dirty.rb

#attribute_change(name) ⇒ Object

Gets the changes for a specific field.

Example:

person = Person.new(:title => "Sir")
person.title = "Madam"
person.attribute_change("title") # [ "Sir", "Madam" ]

Returns:

An Array containing the old and new values.



17
18
19
# File 'lib/mongoid/dirty.rb', line 17

def attribute_change(name)
  modifications[name]
end