diff options
author | Trevor Turk <trevorturk@yahoo.com> | 2009-02-05 00:27:52 -0600 |
---|---|---|
committer | Trevor Turk <trevorturk@yahoo.com> | 2009-02-05 00:27:52 -0600 |
commit | 1b31144961c20f49643c41caf40aa93ea807bce7 (patch) | |
tree | 2eeb51bd09739e2c9ebea0afce5aa22e66ea46ae /railties/guides | |
parent | 4ee9f7979b03e2393dadcd6e7400ffc6256ce6b3 (diff) | |
download | rails-1b31144961c20f49643c41caf40aa93ea807bce7.tar.gz rails-1b31144961c20f49643c41caf40aa93ea807bce7.tar.bz2 rails-1b31144961c20f49643c41caf40aa93ea807bce7.zip |
Fix for validations docs, person.invalid?(:email) should be person.errors.invalid?(:email)
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/activerecord_validations_callbacks.textile | 2 |
1 files changed, 1 insertions, 1 deletions
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 </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. |