diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-15 10:01:40 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-15 10:01:40 +1100 |
commit | d1bedd182bbaae68424c96d24fe5b970ef12779b (patch) | |
tree | 6914da8b327ec9d1a867b020fa5cce2ecfdd2a10 /activemodel/README | |
parent | 23e434f08fa756e9a8c472a8212c6f72ac92b32b (diff) | |
download | rails-d1bedd182bbaae68424c96d24fe5b970ef12779b.tar.gz rails-d1bedd182bbaae68424c96d24fe5b970ef12779b.tar.bz2 rails-d1bedd182bbaae68424c96d24fe5b970ef12779b.zip |
Updated README
Diffstat (limited to 'activemodel/README')
-rw-r--r-- | activemodel/README | 19 |
1 files changed, 19 insertions, 0 deletions
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 |