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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:26:48+00:00 2026-06-13T08:26:48+00:00

I am trying to generate a quick registration form to use Facebook, Twitter and

  • 0

I am trying to generate a quick registration form to use Facebook, Twitter and Linked sign in on my app. But I do have user model that validates some fields on the previous sign up procedure.

I am trying to extend the Registration controller, based on Devise, in order to use the same database for quick registration from the external sign in. This question is formulated because I am running a trial and then I have the sign up form asking for the credit card.

I have this controller:

class Users::QuickRegistrationController < Users::RegistrationsController

  self.model_class = Users::RegistrationsController

end

And then I have this user model:

class User < ActiveRecord::Base  
  validates :name, :presence => true
  validates :first_surname, :presence => true
  validates :prefered_language, :presence => true
  validates :dni, :presence => true, :uniqueness => true #, :format => {:with => /(^\d{7,8}[a-zA-Z]$)|(^[a-zA-Z]\d{7}[a-zA-Z]$)/, :unless => "dni.blank?"}
  validates :phone_number, :presence => true, :format => { :with => /^((\d{9})|([+]\d{11}))$/, :unless => "phone_number.blank?"}, :uniqueness => true
  validates :birthdate, :presence => true, :age => {:adult => :over}
  validates :legal_conditions, :acceptance => {:accept => true}
  validates :email, :confirmation => true
  validates :email_confirmation, :presence => true
  validates :password_confirmation, :presence => true, :if => "new_record?"
  validates :country, :presence => true

Can I say something like validates :first_surname, :presence => false for the Users::QuickRegistrationController and :first_surname, :presence => true for Users::RegistrationsController?

Additionally, there’s a solution to solve this issue on Ruby, can you provide any tutorial or related link?

  • 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-13T08:26:49+00:00Added an answer on June 13, 2026 at 8:26 am

    As 23tux says, validations are based on the model. What I’d do is add a new column to your model:

    add_column :products, :quick_registration, :boolean, default => true
    

    Then in your User model:

    class User < ActiveRecord::Base  
      validates :name, :presence => true
      validates :email, :confirmation => true
      validates :email_confirmation, :presence => true
    
    
      with_options :unless => :quick_registration? do |u|
    
        # These only validate during full registration
        u.validates :first_surname, :presence => true
        u.validates :prefered_language, :presence => true
        u.validates :dni, :presence => true, :uniqueness => true #, :format => {:with => /(^\d{7,8}[a-zA-Z]$)|(^[a-zA-Z]\d{7}[a-zA-Z]$)/, :unless => "dni.blank?"}
        u.validates :phone_number, :presence => true, :format => { :with => /^((\d{9})|([+]\d{11}))$/, :unless => "phone_number.blank?"}, :uniqueness => true
        u.validates :birthdate, :presence => true, :age => {:adult => :over}
        u.validates :legal_conditions, :acceptance => {:accept => true}
        u.validates :password_confirmation, :presence => true, :if => "new_record?"
        u.validates :country, :presence => true
    
      end
    end
    

    Then in your controller, you can ‘switch on’ the additional validations by setting quick_registration to false:

    @user.quick_registration = false
    @user.save   # all validations should fire
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to generate a report of the activities that users have done within
I have been trying to generate report as per age differences of different months
Trying to generate Rails API documentation, but running into errors: $ rake doc:rails rake
Here's a quick background on what I'm trying to do. I have a contact
Just a quick question.. I am trying to generate an text input where the
I'm trying to use Bison to generate a parser, in C++. The grammar is
I'm trying to use Entity Framework for my model/data access, and running into speed
I'm trying generate a images/chart in my controller and have that image displayed in
Trying to generate a table summing totals etc from a query but having trouble
Trying to generate JavaDocs for the Android lint-cli project on Mac 10.7 Keep getting

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.