Custom validation in model

Hello,

is there a way to add a custom validation inside the model ?

like

validates_passwords_are_equal :password, :password_confirm

that would make sure the password and password_confirm fields are the
same ?

thanks
adam

There’s a validation in the core that does precisely that:
validates_confirmation_of:
http://api.rubyonrails.com/classes/ActiveRecord/Validations/
ClassMethods.html#M000653

for custom validations use validates_each:
http://api.rubyonrails.com/classes/ActiveRecord/Validations/
ClassMethods.html#M000652

hth,
Stephen

Check out validates_confirmation_of

Kent