Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…rors.invalid?(:email)
  • Loading branch information...
commit 1b31144961c20f49643c41caf40aa93ea807bce7 1 parent 4ee9f79
Trevor Turk authored
2  railties/guides/source/activerecord_validations_callbacks.textile
View
@@ -537,7 +537,7 @@ class Person < ActiveRecord::Base
end
person = Person.new(:name => "John Doe")
-person.invalid?(:email) # => true
+person.errors.invalid?(:email) # => true
</ruby>
* +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.
Please sign in to comment.
Something went wrong with that request. Please try again.