From c5ff33cd7b9c0dd0340b390a48d1d385629f1134 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 26 Feb 2006 23:58:22 +0000 Subject: 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 --- activerecord/lib/active_record/validations.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') 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: # * message - A custom error message (default is: "can't be blank") # * on - Specifies when this validation is active (default is :save, other options :create, :update) -- cgit v1.2.3