# \[Newbie\] Require old password when changing it (Rails 3)

**URL:** <https://www.ruby-forum.com/t/newbie-require-old-password-when-changing-it-rails-3/195883>\
**Category:** Rails\
**Created:** [October 1, 2010, 9:44pm UTC](https://www.ruby-forum.com/t/newbie-require-old-password-when-changing-it-rails-3/195883 "2010-10-01T21:44:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anders\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Anders\_P](https://www.ruby-forum.com/u/Anders_P)\
**Post date:** [October 1, 2010, 9:44pm UTC](https://www.ruby-forum.com/t/newbie-require-old-password-when-changing-it-rails-3/195883/1 "2010-10-01T21:44:23Z")

</div>

Hello!

I’m trying to create a user update action, and I want to check so that  
the user has entered his correct old password before changing it. I’ve  
been googeling for a while but I can’t find any good tips.

I’m thinking of adding a ‘old password’ column to my User model but I  
don’t know if thats necessary.

My current update action locks like this:

def update  
@user = User.find(params[:id])

```
if @user.update_attributes(params[:user])
  flash[:success] = "Din profil har uppdaterats."
  redirect_to @user
else
  @title = "Redigera profil"
  render 'edit'
end

```

end

I’ve tried a couple of things whiteout good result.

Any general tips would be greatly appreciated.

Thanks  
// Anders
