Permalink
Browse files

fix absence validator doc for boolean field

  • Loading branch information...
1 parent 8b3483f commit 74c3b7f6f61c1115b7409cb8ce9d6832ef9caa75 @acapilleri acapilleri committed Mar 13, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 guides/source/active_record_validations.md
@@ -566,8 +566,8 @@ If you validate the absence of an object associated via a `has_one` or
`has_many` relationship, it will check that the object is neither `present?` nor
`marked_for_destruction?`.
-Since `false.present?` is false, if you want to validate the presence of a boolean
-field you should use `validates :field_name, inclusion: { in: [true, false] }`.
+Since `false.present?` is false, if you want to validate the absence of a boolean
+field you should use `validates :field_name, exclusion: { in: [true, false] }`.
The default error message is _"must be blank"_.

0 comments on commit 74c3b7f

Please sign in to comment.