From c9d86d4148783df4885a9fa4f623fdf6c3079282 Mon Sep 17 00:00:00 2001 From: "Michael D.W. Prendergast" Date: Tue, 23 Dec 2014 19:32:49 -0500 Subject: Clarify that query methods have a custom definition of whether a numeric value is present. [ci skip] The way Active Record query methods handle numeric values is a special case, and is not part of Rails's standard definition of present. This update attempts to make this more clear in the docs, so that people don't expect Object#present? to return false if used on a number that is zero. --- activerecord/lib/active_record/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 08322921c6..954d22f1d5 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -140,8 +140,8 @@ module ActiveRecord #:nodoc: # == Attribute query methods # # In addition to the basic accessors, query methods are also automatically available on the Active Record object. - # Query methods allow you to test whether an attribute value is present, as defined by Object#present?. - # For numeric values, present is defined as non-zero. + # Query methods allow you to test whether an attribute value is present. + # Additionally, when dealing with numeric values, a query method will return false if the value is zero. # # For example, an Active Record User with the name attribute has a name? method that you can call # to determine whether the user has a name: -- cgit v1.2.3