small medium large xlarge

19 Sep 2013, 15:19
Aynanolog Aynanae (2 posts)

I’m getting “Password can’t be blank” error when trying to create a new user.

If I remove the “has_secure_password” from user.rb then the error doesn’t show and I can create user.

What I am doing wrong?

Thanks for help in advance!

23 Nov 2013, 19:43
Roman Adamiv (1 post)

Have the same problem, was fighting with this during some days, but I failed.

“Password can’t be blank”

Rails 4.0.1

gem ‘bcrypt-ruby’, ‘~>3.1.2’

I tried the other versions of bcrypt I also thought that problem is with OS, because mailny I did the project at MS Win 7 (32bit), then tried the same at Ubuntu but error didn’t gone.

Strange situation.

15 Jan 2014, 16:48
Albert VJ (1 post)

The user table should have a password_digest column. Try this: at prompt: rails generate migration ChangeColName Then edit db\migrate\xyz_change_col_name : … def change rename_column :users, :hashed_password, :password_digest end … where :hashed_password is the name of the old column to be renamed to :password_digest.

11 Apr 2014, 20:44
Brett Krchnavy (1 post)

Assuming you found the answer but for those still having the error here is the fix.

In Rails 4 it makes a private methods for params to stop people from injecting params.

it defaults in this case to:

def user_params

  params.require(:user).permit(:name, :password_digest)


you need to change it to:

def user_params

  params.require(:user).permit(:name, :password, :password_confirmation)


You must be logged in to comment