From 1b31144961c20f49643c41caf40aa93ea807bce7 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 5 Feb 2009 00:27:52 -0600 Subject: Fix for validations docs, person.invalid?(:email) should be person.errors.invalid?(:email) --- railties/guides/source/activerecord_validations_callbacks.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/activerecord_validations_callbacks.textile b/railties/guides/source/activerecord_validations_callbacks.textile index 86b2e95bf4..553206d762 100644 --- a/railties/guides/source/activerecord_validations_callbacks.textile +++ b/railties/guides/source/activerecord_validations_callbacks.textile @@ -537,7 +537,7 @@ class Person < ActiveRecord::Base end person = Person.new(:name => "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. -- cgit v1.2.3