aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2015-02-06 10:22:53 +0100
committerXavier Noria <fxn@hashref.com>2015-02-06 10:29:05 +0100
commit6f8d9bd6da6349d3d179f2e72db5bc7044a8e5c1 (patch)
tree9d935cb48f5b8b1eff8b21b61bd932a5b48a7951
parenta2af7bb9280f2b52da0f8af3796fbe2e388025ff (diff)
downloadrails-6f8d9bd6da6349d3d179f2e72db5bc7044a8e5c1.tar.gz
rails-6f8d9bd6da6349d3d179f2e72db5bc7044a8e5c1.tar.bz2
rails-6f8d9bd6da6349d3d179f2e72db5bc7044a8e5c1.zip
revises AM:Dirty example [Godfrey Chan & Xavier Noria]
The existing example seems somewhat forced: is it realistic to have a model that accepts state in its initializer but considers it has not been changed? By allowing state changes to happen only via accessors it seems more natural that new instances are considered to be unchanged (as they are in AR). [ci skip]
-rw-r--r--activemodel/lib/active_model/dirty.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb
index 5262f6c5e0..ca5dac272f 100644
--- a/activemodel/lib/active_model/dirty.rb
+++ b/activemodel/lib/active_model/dirty.rb
@@ -26,10 +26,6 @@ module ActiveModel
#
# define_attribute_methods :name
#
- # def initialize(name = nil)
- # @name = name
- # end
- #
# def name
# @name
# end
@@ -56,9 +52,9 @@ module ActiveModel
# end
# end
#
- # A newly instantiated object is unchanged:
+ # A newly instantiated +Person+ object is unchanged:
#
- # person = Person.new('Uncle Bob')
+ # person = Person.new
# person.changed? # => false
#
# Change the name: