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 985039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:06:26+00:00 2026-05-16T05:06:26+00:00

I am quite new to rails and I am using authlogic for my authentication

  • 0

I am quite new to rails and I am using authlogic for my authentication system. I want to have password_confirmation when user updates his profile, but not when he is signing up.

I figured out this config option

acts_as_authentic do |c|
  c.require_password_confirmation=false
end

When I do this, it ignores password_confirmation during signup (which is fine) but while editing user profile, I want it to consider password_confirmation field. is there any method I can configure this?

  • 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-05-16T05:06:27+00:00Added an answer on May 16, 2026 at 5:06 am

    As you have suspended the Authlogic based validation you can achieve this with a standard Rails model validation such as:

    validates_presence_of :password_confirmation, :if => :password_required?
    

    where the password_required? is an optional model method, which tests if you want this validation for a given scenario.

    UPDATE

    As it seems that the c.require_password_confirmation=false option means the password_confirmation attribute is no longer automatically created then you need to approach the solution slightly differently. Create a virtual attribute manually and a custom validation for the specific case of profile updates. Something like this:

    class User < ActiveRecord::Base
      attr_accessor :password_confirmation
    
      validate do |user|
        unless user.new_record?
          user.errors.add :password, "is required" if self.password.blank?
          user.errors.add :password_confirmation, "is required" if self.password_confirmation.blank?
          user.errors.add_to_base, "Password and confirmation must match" if self.password != self.password_confirmation
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to rails, and have a situation that I can't quite get
I'm completely new to Rails, but I've done quite a bit of searching and
I'm using rails 3.2 and devise 2.0 and I'm quite new to Rails. Requirements
I'm quite new at Rails but can find my way around for the time
Im quite new to rails and stumpled upon a challenge.. I have 3 models,
I am quite new to rails. I have this code in my controller: @schedules
I'm currently using Rails v2.3.5 at work and I'm quite new both to the
So, I'm quite new to Rails and still working my way through the principles.
Still quite new to Haskell.. I want to read the contents of a file,
I'm quite new to php and have been reading Larry Ullman book to develop

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.