diff options
author | Vipul A M <vipulnsward@gmail.com> | 2015-02-03 12:09:42 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2015-02-03 12:09:42 +0530 |
commit | fc87123fe85037a0071c5f4d43135fd604452b95 (patch) | |
tree | d569f6d750b1184d384105488fa13ef78be523a0 /activemodel/lib | |
parent | 186418724c6da41caeb0fd304894bcfcc154b8bb (diff) | |
download | rails-fc87123fe85037a0071c5f4d43135fd604452b95.tar.gz rails-fc87123fe85037a0071c5f4d43135fd604452b95.tar.bz2 rails-fc87123fe85037a0071c5f4d43135fd604452b95.zip |
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]
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/dirty.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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: |