Permalink
Browse files

Merge pull request #15063 from cbeer/correct-attribute_present-docs

correcting method documentation [ci skip]
  • Loading branch information...
2 parents d4fafeb + ff5e8f9 commit df5c9aa447bb687aa2eee16845cb8526e83aaf13 @guilleiguaran guilleiguaran committed May 12, 2014
Showing with 7 additions and 7 deletions.
  1. +7 −7 activerecord/lib/active_record/attribute_methods.rb
@@ -326,13 +326,13 @@ def attribute_for_inspect(attr_name)
# 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?)

0 comments on commit df5c9aa

Please sign in to comment.