mirror of
https://github.com/jbranchaud/til
synced 2026-01-04 23:58:01 +00:00
Update Attribute Was with a link to the ActiveModel module.
This commit is contained in:
@@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
When modifying the attributes of an `ActiveRecord` object, you may want to
|
When modifying the attributes of an `ActiveRecord` object, you may want to
|
||||||
know what values the modified attributes used to have. `ActiveRecord` gets
|
know what values the modified attributes used to have. `ActiveRecord` gets
|
||||||
some handy methods from the `ActiveModel::Dirty` module that allow you to
|
some handy methods from the
|
||||||
check these values out even if the object's attributes were changed before
|
[`ActiveModel::Dirty`](http://api.rubyonrails.org/classes/ActiveModel/Dirty.html)
|
||||||
you received it (though you are out of luck once it has been saved).
|
module that allow you to check these values out even if the object's
|
||||||
Just add `_was` onto the end of the attribute in question.
|
attributes were changed before you received it (though you are out of luck
|
||||||
|
once it has been saved). Just add `_was` onto the end of the attribute in
|
||||||
|
question.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
>> pokemon.name
|
>> pokemon.name
|
||||||
|
|||||||
Reference in New Issue
Block a user