From d1bedd182bbaae68424c96d24fe5b970ef12779b Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Fri, 15 Jan 2010 10:01:40 +1100 Subject: [PATCH] Updated README --- activemodel/README | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/activemodel/README b/activemodel/README index c0d59f7208..46f02aa651 100644 --- a/activemodel/README +++ b/activemodel/README @@ -39,3 +39,22 @@ You can include functionality from the following modules: ...returns the class itself when sent :to_model +* Tracking changes in your object + + class MyClass + include ActiveModel::Dirty + + end + + ...provides all the value tracking features implemented by ActiveRecord + + person.name # => 'bill' + person.changed? # => false + person.name = 'bob' + person.changed? # => true + person.changed # => ['name'] + person.changes # => { 'name' => ['bill', 'bob'] } + person.name = 'robert' + person.save + person.previous_changes # => {'name' => ['bob, 'robert']} + \ No newline at end of file