Skip to content

Commit

Permalink
applies guidelines to dirty.rb [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Feb 6, 2015
1 parent 0f4a848 commit a845757
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions activemodel/lib/active_model/dirty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module ActiveModel
# A newly instantiated object is unchanged:
#
# person = Person.new 'Uncle Bob'
# person.changed? # => false
# person.changed? # => false
#
# Change the name:
#
Expand All @@ -76,8 +76,8 @@ module ActiveModel
# Save the changes:
#
# person.save
# person.changed? # => false
# person.name_changed? # => false
# person.changed? # => false
# person.name_changed? # => false
#
# Reset the changes:
#
Expand All @@ -89,20 +89,20 @@ module ActiveModel
#
# person.name = "Uncle Bob"
# person.rollback!
# person.name # => "Bill"
# person.name_changed? # => false
# person.name # => "Bill"
# person.name_changed? # => false
#
# Assigning the same value leaves the attribute unchanged:
#
# person.name = 'Bill'
# person.name_changed? # => false
# person.name_change # => nil
# person.name_changed? # => false
# person.name_change # => nil
#
# Which attributes have changed?
#
# person.name = 'Bob'
# person.changed # => ["name"]
# person.changes # => {"name" => ["Bill", "Bob"]}
# person.changed # => ["name"]
# person.changes # => {"name" => ["Bill", "Bob"]}
#
# If an attribute is modified in-place then make use of
# +[attribute_name]_will_change!+ to mark that the attribute is changing.
Expand All @@ -111,9 +111,9 @@ module ActiveModel
# not need to call +[attribute_name]_will_change!+ on Active Record models.
#
# person.name_will_change!
# person.name_change # => ["Bill", "Bill"]
# person.name_change # => ["Bill", "Bill"]
# person.name << 'y'
# person.name_change # => ["Bill", "Billy"]
# person.name_change # => ["Bill", "Billy"]
module Dirty
extend ActiveSupport::Concern
include ActiveModel::AttributeMethods
Expand Down

0 comments on commit a845757

Please sign in to comment.