mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Updated README
This commit is contained in:
parent
23e434f08f
commit
d1bedd182b
1 changed files with 19 additions and 0 deletions
|
@ -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']}
|
||||
|
Loading…
Reference in a new issue