Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8044655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:17:42+00:00 2026-06-05T05:17:42+00:00

I am using has_secure_password to verify my user password and its confirmation. The problem

  • 0

I am using has_secure_password to verify my user password and its confirmation. The problem I have is that when there are any errors, the fields are not being wrapped with a field_with_errors div. I know that I can add

validates_presence_of :password, :on => :create
validates_presence_of :password_confirmation, :on => :create

but that creates the following error message:

Password digest can’t be blank.
Password can’t be blank.
Password confirmation can’t be blank

I would like to either make the has_secure_password wrap the fields with errors with a field_with_errors div or remove the “Password digest can’t be blank.” error altogether.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:17:44+00:00Added an answer on June 5, 2026 at 5:17 am

    The SecurePassword module which has this functionality is quite simple and worth a look. Good news is that in the master branch (Rails 4) it does validates_presence_of :password, :on => :create which will solve your problem, but in the meantime you might want to mimic the has_secure_password method on the User model yourself.

    class User < ActiveRecord::Base
      attr_reader :password
      attr_accessible :password # ...
      validates_confirmation_of :password
      validates_presence_of :password, on: :create
      include ActiveModel::SecurePassword::InstanceMethodsOnActivation
    end
    

    Also make sure bcrypt is loaded in Gemfile.

    gem 'bcrypt-ruby', '~> 3.0.0', require: 'bcrypt'
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening. I have a problem. i am using has_secure_password and cause of this
So I have a quartz installation using JDBCJobStore that has multiple tomcat workers. Is
Ok I have a user form that has values submitted to the database. My
C# has the using statement, specifically for IDisposable objects. Presumably, any object specified in
I know that C# has the using keyword, but using disposes of the object
I'm creating a msi based installer (using InstallShield) that has a custom action to
I'm using a a jQuery plugin to evaluate password strength. It gives a graphical
Experimented sending secure emails using C# and was wondering if I have understood things
This is suppose to be a basic password change method using DirectoryServices in ASP.NET.
I'm building a password manager in PHP where the user can store and access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.