aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-04 06:33:22 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-04 06:33:22 +0000
commitf3d6726dfa3efdb895a85f5e2f72e7b430b788e9 (patch)
treea858d5b77610b6e3b4449a8bfd4b3141a0260c6d /activerecord/lib/active_record
parent9f3ba03bc71e03814a090d8fcf1f8c4c3d5e4c49 (diff)
downloadrails-f3d6726dfa3efdb895a85f5e2f72e7b430b788e9.tar.gz
rails-f3d6726dfa3efdb895a85f5e2f72e7b430b788e9.tar.bz2
rails-f3d6726dfa3efdb895a85f5e2f72e7b430b788e9.zip
Document validates_presences_of behavior with booleans: you probably want validates_inclusion_of :attr, :in => [true, false]. Closes #2253.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4980 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/validations.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index c1353e9d56..c9d4740670 100755
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -375,6 +375,10 @@ module ActiveRecord
#
# The first_name attribute must be in the object and it cannot be blank.
#
+ # If you want to validate the presence of a boolean field (where the real values are true and false),
+ # you will want to use validates_inclusion_of :field_name, :in => [true, false]
+ # This is due to the way Object#blank? handles boolean values. false.blank? # => true
+ #
# Configuration options:
# * <tt>message</tt> - A custom error message (default is: "can't be blank")
# * <tt>on</tt> - Specifies when this validation is active (default is :save, other options :create, :update)