From fc87123fe85037a0071c5f4d43135fd604452b95 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Tue, 3 Feb 2015 12:09:42 +0530 Subject: Person class doesn't contain finder methods, hence usage of Person.find_by is wrong. Added simple initialize and made use of Person.new instead of Person.find_by to clarify the docs. [ci skip] --- activemodel/lib/active_model/dirty.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb index 614bc6a5d8..f5147d466e 100644 --- a/activemodel/lib/active_model/dirty.rb +++ b/activemodel/lib/active_model/dirty.rb @@ -26,6 +26,10 @@ module ActiveModel # # define_attribute_methods :name # + # def initialize name = nil + # @name = name + # end + # # def name # @name # end @@ -54,7 +58,7 @@ module ActiveModel # # A newly instantiated object is unchanged: # - # person = Person.find_by(name: 'Uncle Bob') + # person = Person.new 'Uncle Bob' # person.changed? # => false # # Change the name: -- cgit v1.2.3