diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-05-25 21:44:38 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-05-25 22:17:36 +0530 |
commit | cc10dff1ad8f16386e860bd92fe930d2222ba695 (patch) | |
tree | ca3e20dfdb256e371bf5f243b13eea066b79d0f6 /railties/guides/source/active_record_validations_callbacks.textile | |
parent | 084750c2d072844d68258d4326ad3f9ae67def8e (diff) | |
download | rails-cc10dff1ad8f16386e860bd92fe930d2222ba695.tar.gz rails-cc10dff1ad8f16386e860bd92fe930d2222ba695.tar.bz2 rails-cc10dff1ad8f16386e860bd92fe930d2222ba695.zip |
changes validates_confirmation_of to newer syntax
Diffstat (limited to 'railties/guides/source/active_record_validations_callbacks.textile')
-rw-r--r-- | railties/guides/source/active_record_validations_callbacks.textile | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index fdc123fdae..618d02c9d3 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -208,7 +208,7 @@ You should use this helper when you have two text fields that should receive exa <ruby> class Person < ActiveRecord::Base - validates_confirmation_of :email + validates :email, :confirmation => true end </ruby> @@ -223,8 +223,8 @@ This check is performed only if +email_confirmation+ is not +nil+. To require co <ruby> class Person < ActiveRecord::Base - validates_confirmation_of :email - validates_presence_of :email_confirmation + validates :email, :confirmation => true + validates :email_confirmation, :presence => true end </ruby> @@ -547,7 +547,7 @@ Finally, it's possible to associate +:if+ and +:unless+ with a +Proc+ object whi <ruby> class Account < ActiveRecord::Base - validates_confirmation_of :password, + validates :password, :confirmation => true, :unless => Proc.new { |a| a.password.blank? } end </ruby> |