2019-09-16 17:57:47 -04:00
|
|
|
* Raise FrozenError when trying to write attributes that aren't backed by the database on an object that is frozen:
|
|
|
|
|
|
|
|
class Animal
|
|
|
|
include ActiveModel::Attributes
|
|
|
|
attribute :age
|
|
|
|
end
|
|
|
|
|
|
|
|
animal = Animal.new
|
|
|
|
animal.freeze
|
|
|
|
animal.age = 25 # => FrozenError, "can't modify a frozen Animal"
|
|
|
|
|
2019-08-01 18:38:03 -04:00
|
|
|
* Add *_previously_was attribute methods when dirty tracking. Example:
|
2019-03-29 05:21:56 -04:00
|
|
|
|
2019-08-01 18:38:03 -04:00
|
|
|
pirate.update(catchphrase: "Ahoy!")
|
|
|
|
pirate.previous_changes["catchphrase"] # => ["Thar She Blows!", "Ahoy!"]
|
|
|
|
pirate.catchphrase_previously_was # => "Thar She Blows!"
|
|
|
|
|
|
|
|
*DHH*
|
2019-03-29 05:21:56 -04:00
|
|
|
|
2019-04-24 15:57:14 -04:00
|
|
|
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activemodel/CHANGELOG.md) for previous changes.
|