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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:20:40+00:00 2026-05-15T12:20:40+00:00

is there any possibility to perform conditional validation in authlogic’s model User, that uses

  • 0

is there any possibility to perform conditional validation in authlogic’s model User, that uses validation inside acts_as_authentic block depending on some conditions? I’m trying to implement multistep registration form, described in Ryan Bates’s railscast 217 with authlogic.

  • 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-15T12:20:41+00:00Added an answer on May 15, 2026 at 12:20 pm

    Yes, it is possible to set conditional validations with authlogic. In your User model you could have:

    class User < ActiveRecord::Base
    
    acts_as_authentic do |config|
      config.merge_validates_format_of_login_field_options {:if => :do_validation}
    end
    

    where :do_validation is a method in User that returns true or false based on some condition you define. There are other hooks you can use as well. See http://www.rubydox.net/class/authlogic/2.1.3/Authlogic::ActsAsAuthentic::Login::Config for info related to this example. You can do similar things for password field.

    Please note the example code above is from memory as I am not in a place where I can refer to my own source in which I did this very thing. I will verify tomorrow when I return to work and correct if necessary.

    UPDATE I verified my code example is correct. It may be useful to also note that any of the standard RoR options for validates_format_of can be merged into this particular authlogic config setting. http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M001401

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

Sidebar

Related Questions

Is there any Possibility that it can Generate Compressed HTML from the GridVIew ???
Is there any possibility that GetPropInfo returns nil even if the given class is
Is there any possibility to create a configuration file with global variables that are
Is there any possibility to create an application for iphone/ipad and when user download
Is there any possibility that a object which is not referenced anywhere and still
Are there any possibility to do something like that? Or how I can simulate
Is there any possibility of assigning user agent string to web browser control in
Is there any possibility that can i get the IMEI # Of Mobile from
Is there any possibility to perform graceful restart and check apache config syntax without
Is there any possibility to change the text-color of some parts in a textarea

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.