[Rails] Extra Fields?

Russ Smith russ at igeanetwork.com
Thu Nov 11 21:20:24 GMT 2004


I like the idea of keeping the validation in the model. It just makes 
the controller code feel cleaner.

On Nov 11, 2004, at 1:13 PM, Alexey Verkhovsky wrote:

> 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
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>



More information about the Rails mailing list