aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-26 23:58:22 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-26 23:58:22 +0000
commitc5ff33cd7b9c0dd0340b390a48d1d385629f1134 (patch)
treebce9bf292ffed53df51d34f59446cf29ddf17e66 /activerecord/lib/active_record
parent6bd8e351361a895e7ada7d7702bb099034103d62 (diff)
downloadrails-c5ff33cd7b9c0dd0340b390a48d1d385629f1134.tar.gz
rails-c5ff33cd7b9c0dd0340b390a48d1d385629f1134.tar.bz2
rails-c5ff33cd7b9c0dd0340b390a48d1d385629f1134.zip
Example for validates_presence_of method (closes #3966) [Robby Russell]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3677 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/validations.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index 950cf54b12..53c4f596fe 100755
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -364,8 +364,14 @@ module ActiveRecord
end
end
- # Validates that the specified attributes are not blank (as defined by Object#blank?). Happens by default on save.
+ # Validates that the specified attributes are not blank (as defined by Object#blank?). Happens by default on save. Example:
#
+ # class Person < ActiveRecord::Base
+ # validates_presence_of :first_name
+ # end
+ #
+ # The first_name attribute must be in the object and it cannot be blank.
+ #
# Configuration options:
# * <tt>message</tt> - A custom error message (default is: "can't be blank")
# * <tt>on</tt> - Specifies when this validation is active (default is :save, other options :create, :update)