aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods.rb
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2014-05-11 21:30:29 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2014-05-11 21:30:29 -0500
commitdf5c9aa447bb687aa2eee16845cb8526e83aaf13 (patch)
treee0167f17383f7a6db350f22b8d8ff474fef3d3c1 /activerecord/lib/active_record/attribute_methods.rb
parentd4fafeb003e472283914d3246d5aea92a0ea795c (diff)
parentff5e8f9a24c0505ae17888be82a65fb9c864bffe (diff)
downloadrails-df5c9aa447bb687aa2eee16845cb8526e83aaf13.tar.gz
rails-df5c9aa447bb687aa2eee16845cb8526e83aaf13.tar.bz2
rails-df5c9aa447bb687aa2eee16845cb8526e83aaf13.zip
Merge pull request #15063 from cbeer/correct-attribute_present-docs
correcting method documentation [ci skip]
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods.rb')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 4b1733619a..5b4043039b 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -326,13 +326,13 @@ module ActiveRecord
# class Task < ActiveRecord::Base
# end
#
- # person = Task.new(title: '', is_done: false)
- # person.attribute_present?(:title) # => false
- # person.attribute_present?(:is_done) # => true
- # person.name = 'Francesco'
- # person.is_done = true
- # person.attribute_present?(:title) # => true
- # person.attribute_present?(:is_done) # => true
+ # task = Task.new(title: '', is_done: false)
+ # task.attribute_present?(:title) # => false
+ # task.attribute_present?(:is_done) # => true
+ # task.title = 'Francesco'
+ # task.is_done = true
+ # task.attribute_present?(:title) # => true
+ # task.attribute_present?(:is_done) # => true
def attribute_present?(attribute)
value = read_attribute(attribute)
!value.nil? && !(value.respond_to?(:empty?) && value.empty?)