Jeremy Kemper:
class Model < ActiveRecord::Base
attr_accessor :password, :password_confirmation
def validate
errors.add(''password'', ''Password and
confirmation do not match'')
unless password_confirmation == password
end
def before_save
self.password_sha1 = Digest::SHA1(password) if password
end
end
On Nov 30, 2004, at 12:25 AM, Jeff Moss wrote:
> I''m trying to insert a user account into a database, and I have a
> password confirm field. I want to use the built in activerecord
> validation to test that password and password_confirm are the same,
> but I dont want to save password_confirm in the database. Anybody know
> the best way to do this?
>
> -Jeff
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>