Improve Active Model Dirty API.#16180
Conversation
…_information
This method name is causing confusion with the `reset_#{attribute}`
methods. While `reset_name` set the value of the name attribute for the
previous value the `reset_changes` only discard the changes and previous
changes.
|
|
There was a problem hiding this comment.
def restore_attribute!(attr)? 😄
|
|
|
❤️ 💚 💙 💛 💜 |
|
|
|
How about As a bonus, it could take a list of attributes for when you want to restrict it to just a subset of possibly-changed-or-not attributes (e.g. Not sure if "attributes" is what you call them in the Active Model layer though. |
|
(or |
|
I like |
These methods may cause confusion with the `reset_changes` that behaves differently of them. Also rename undo_changes to restore_changes to match this new set of methods.
|
Changed to |
|
❤️ |
Improve Active Model Dirty API.
|
good job |
I did some changes on this API:
reset_changesbecomesclear_changes_information. I believe this new name matches with what it is doing.reset_*is deprecated in favor ofrestore_*. This will avoid confusion with the deprecated reset_changes.undo_changesis nowrestore_attributes. To match the behaviour ofrestore_*.@dhh @chancancode