[Rails] Extra Fields?

Alexey Verkhovsky alex at verk.info
Thu Nov 11 21:13:04 GMT 2004


Tobias Luetke wrote:

>I would recommend against doing the confirm password validation as
>part of the model.
>
>This would have the disadvantage that you have to supply password
>confirmation whenever want to create a user. Inconvenient for admin
>interfaces and especially from IRB.
>  
>

You can always write the check condition as:

if self.confirm_password && self.password == self.confirm_password

and if no confirm_password is provided, don't change the password.

The big advantage is consistent use of AR::Errors in the form for 
reporting mismatched password.

Alex


More information about the Rails mailing list