Hi,
I am working on some basic authentication for a Rails project. Here is
my User.rb file:
====== ====== ====== ====== ====== =====
class User < ActiveRecord::Base
attr_reader :password
attr_accessor :password_confirmation
validates_presence_of :name, :username
validates_presence_of :password, :password_confirmation
validates_confirmation_of :password
def password=(pwd)
self.password_salt = "salt"
self.password_hash = "hash"
end
end
====== ====== ====== ====== ====== =====
When I try to submit the form to create a new user, I always get a
"Password doesn''t match confirmation" error. The password
field on my
form becomes blank, but the password_confirmation field maintains the
password from the previous form submission. The only way to avoid this
is the remove the password=(pwd) function. What am I doing wrong?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---