aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods.rb
diff options
context:
space:
mode:
authorChris Beer <cabeer@stanford.edu>2014-05-11 19:26:21 -0700
committerChris Beer <cabeer@stanford.edu>2014-05-11 19:26:45 -0700
commitff5e8f9a24c0505ae17888be82a65fb9c864bffe (patch)
treeaebb83f1d0aae8f13269ec6903eb42bb60f7ef2b /activerecord/lib/active_record/attribute_methods.rb
parentbab48f0a3d53a08bc23ea0887219e8deb963c3d9 (diff)
downloadrails-ff5e8f9a24c0505ae17888be82a65fb9c864bffe.tar.gz
rails-ff5e8f9a24c0505ae17888be82a65fb9c864bffe.tar.bz2
rails-ff5e8f9a24c0505ae17888be82a65fb9c864bffe.zip
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?)