Last active
March 17, 2016 15:45
-
-
Save soniaprevost/d592115ac88ce75504f4 to your computer and use it in GitHub Desktop.
Tracker les changements des instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sur tous les attributs | |
person.changes # => { "name" => ["bill", "bob"] } | |
# vérifier s'il y a eu un changement sur l'instance | |
person.changed? # => false | |
# récupérer la valeur changée | |
person.name_was # => "Uncle Bob" | |
Et plein d'autres => http://api.rubyonrails.org/classes/ActiveModel/Dirty.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment