auth logic - password confirmation

Hi, newbie here. :slight_smile:

i have this form on a test rails app:

<% form_for @user do |f| %>   <%= f.error_messages %>   <p>     <%= f.label :username %><br />     <%= f.text_field :username %>   </p>   <p>     <%= f.label :email %><br />     <%= f.text_field :email %>   </p>   <p>     <%= f.label :password %><br />     <%= f.password_field :password %>   </p>   <p>     <%= f.label :password_confirmation %><br />     <%= f.password_field :password_confirmation %>   </p>   <p><%= f.submit %></p> <% 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?

In the user model there should be something like:

attr_accessor :password_confirmation

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