Hi, newbie here.
i have this form on a test rails app:
<% form_for @user do |f| %>
<%= f.error_messages %>
<%= f.label :username %>
<%= f.text_field :username %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :password %>
<%= f.password_field :password %>
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation %>
<%= f.submit %>
<% end %>
I am following this railscast here
http://media.railscasts.com/videos/160_authlogic.mov
Half way he changes password_field and also ads password_confirmation
and it works great in the video but for me i get this error
undefined method `password_confirmation’ for #User:0x1036485d0
how come that password_confirmation method is not defined?
any tips?
On Tue, Aug 17, 2010 at 9:58 PM, oliver torres [email protected]
wrote:
I am following this railscast here
http://media.railscasts.com/videos/160_authlogic.mov
Half way he changes password_field and also ads password_confirmation
and it works great in the video but for me i get this error
undefined method `password_confirmation’ for #User:0x1036485d0
how come that password_confirmation method is not defined?
any tips?
In the user model there should be something like:
attr_accessor :password_confirmation
–
Greg D.
destiney.com | gregdonald.com
On Tue, Aug 17, 2010 at 22:58, oliver torres [email protected]
wrote:
it works great in the video but for me i get this error
undefined method `password_confirmation’ for #User:0x1036485d0
how come that password_confirmation method is not defined?
any tips?
Most likely the method/data/whatever is not defined because the actual
final saved user, does not need to store it. It’s only useful when
[re]setting the password. Off the top of my pointy little head, I’d
guess a before_save filter (to check whether it matches the actual
password, and if so then remove it, else flag the record invalid) is
what you want.
-Dave
–
Specialization is for insects. -RAH | Have Pun, Will Babble! -me
Programming Blog: http://codosaur.us | Work: http://davearonson.com
Leadership Blog: http://dare2xl.com | Play: http://davearonson.net