# Auth logic - password confirmation

**URL:** <https://www.ruby-forum.com/t/auth-logic-password-confirmation/193462>\
**Category:** Rails\
**Created:** [August 18, 2010, 5:08am UTC](https://www.ruby-forum.com/t/auth-logic-password-confirmation/193462 "2010-08-18T05:08:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliver\_torres](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a9a28c/32.png) [@oliver\_torres](https://www.ruby-forum.com/u/oliver_torres)\
**Post date:** [August 18, 2010, 5:08am UTC](https://www.ruby-forum.com/t/auth-logic-password-confirmation/193462/1 "2010-08-18T05:08:40Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![oliver\_torres](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a9a28c/32.png) [@oliver\_torres](https://www.ruby-forum.com/u/oliver_torres)\
**Post date:** [August 18, 2010, 6:15am UTC](https://www.ruby-forum.com/t/auth-logic-password-confirmation/193462/2 "2010-08-18T06:15:24Z")

</div>

On Tue, Aug 17, 2010 at 9:58 PM, oliver torres [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I am following this railscast here  
> [http://media.railscasts.com/videos/160\_authlogic.mov](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](http://destiney.com) | [gregdonald.com](http://gregdonald.com)

---

<div class="post-metadata">

**Author:** ![oliver\_torres](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a9a28c/32.png) [@oliver\_torres](https://www.ruby-forum.com/u/oliver_torres)\
**Post date:** [August 18, 2010, 3:28pm UTC](https://www.ruby-forum.com/t/auth-logic-password-confirmation/193462/3 "2010-08-18T15:28:35Z")

</div>

On Tue, Aug 17, 2010 at 22:58, oliver torres [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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](http://codosaur.us) | Work: [http://davearonson.com](http://davearonson.com)  
Leadership Blog: [http://dare2xl.com](http://dare2xl.com) | Play: [http://davearonson.net](http://davearonson.net)

- 
  - 
    - 
      - 
        - WATCH THIS SPACE \* \* \* \* \* | Ruby: [http://mars.groupsite.com](http://mars.groupsite.com)
