Skip to content

Instantly share code, notes, and snippets.

View soniaprevost's full-sized avatar
👩‍🎤
Rocking @ Enercoop

Sonia Prévost soniaprevost

👩‍🎤
Rocking @ Enercoop
View GitHub Profile
@soniaprevost
soniaprevost / essential_gems.rb
Last active January 20, 2017 15:13
Essential Gems to start any project
### with no setup ###
# template language to shorten html
gem 'slim', '~> 3.0', '>= 3.0.7'
# manage translation
gem 'i18n', '~> 0.7.0'
# in group :development for better error pages
gem 'better_errors', '~> 2.1', '>= 2.1.1'
@soniaprevost
soniaprevost / ActiveModelDirty
Last active March 17, 2016 15:45
Tracker les changements des instances
# 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