Browse files

Fix for validations docs, person.invalid?(:email) should be…

  • Loading branch information...
1 parent 4ee9f79 commit 1b31144961c20f49643c41caf40aa93ea807bce7 Trevor Turk committed Feb 5, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 railties/guides/source/activerecord_validations_callbacks.textile
2 railties/guides/source/activerecord_validations_callbacks.textile
@@ -537,7 +537,7 @@ class Person < ActiveRecord::Base
person = => "John Doe")
-person.invalid?(:email) # => true
+person.errors.invalid?(:email) # => true
* +on+ is used when you want to check the error messages for a specific attribute. It will return different kinds of objects depending on the state of the +errors+ collection for the given attribute. If there are no errors related to the attribute, +on+ will return +nil+. If there is just one errors message for this attribute, +on+ will return a string with the message. When +errors+ holds two or more error messages for the attribute, +on+ will return an array of strings, each one with one error message.

0 comments on commit 1b31144

Please sign in to comment.