Validations

Hi,

I have a question related to validations. My user table has a password field. I have some validations related to password field in my model file for this table (user.rb). I have a typical form to change password form where I have three fields namely current password, new password and retype password.

My validations for other forms work, but those forms are one for each table. For this particular form, validations don't work. Do I have to write separate validations for this form in action or can I reuse these validations in some way? If there is some other way, please elaborate.

-- password related validation defs from user.rb --

attr_accessor :password validates_presence_of :password, :password_confirmation, :if => :password_required?, :message => "Password cannot be blank" validates_length_of :password, :within => 8..32, :if => :password_required? validates_confirmation_of :password, :if => :password_required?, :message => "New password and retyped password don't match"

-- password related validation defs from user.rb end here --

Thank you.

:wq Sameer.