Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

correcting method documentation [ci skip]
  • Loading branch information...
commit df5c9aa447bb687aa2eee16845cb8526e83aaf13 2 parents d4fafeb + ff5e8f9
@guilleiguaran guilleiguaran authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 activerecord/lib/active_record/attribute_methods.rb
View
14 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?)
Please sign in to comment.
Something went wrong with that request. Please try again.