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
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs