From 6f8d9bd6da6349d3d179f2e72db5bc7044a8e5c1 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 6 Feb 2015 10:22:53 +0100 Subject: 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] --- activemodel/lib/active_model/dirty.rb | 8 ++------ 1 file 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: -- cgit v1.2.3