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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:09:02+00:00 2026-06-04T18:09:02+00:00

I am trying to add a new field registration code along with the email/password

  • 0

I am trying to add a new field “registration code” along with the email/password in sign up form. (i have the registration code field in a separate database, only a valid registration code/email pair will have to work with the sign up)

I could not able to find any controller for actions done by devise gem.

How do i customize devise to achieve this?

Thanks in advance.

  • 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-04T18:09:03+00:00Added an answer on June 4, 2026 at 6:09 pm

    It seems like your question basically has nothing to do with Devise itself (besides the views). To validate your registration code/email pairs, you surely need to add this as validation.

    The easy way to validate registration code could be:

    class User
      validate :validate_registration_code
    
      private
      def validate_registration_code
        reg_code =  RegistrationCode.find_by_code(registration_code)
        unless reg_code.email == record.email
          errors.add(:registration_code, "Invalid registration code for #{record.email}")
        end
      end
    end
    

    You also might want to write simple custom validator:

    class RegistrationCodeValidator < ActiveModel::Validator
      def validate(record)
        # actual reg code validation
        # might look like:
        reg_code =  RegistrationCode.find_by_code(record.registration_code)
        unless reg_code.email == record.email
          record.errors[:registration_code] << "Invalid registration code for #{record.email}"
        end
      end
    end
    
    # in your User model
    class User
      # include registration code validator
      include RegistrationCodeValidator
      validates_with MyValidator
    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 wordpress and widgets. I am trying to add another field
I'm fairly new to JQuery and I'm trying to add multiple form fields for
Im trying to add an element to a database and then return a new
I have created a index as Document doc = new Document(); doc.Add(new Field(SearchKey, (item.FullTextColumn
I'm trying to create a registration form. In this form there are some fields(username,password
In a Perl object, I'm trying to add a new field into $self from
Im trying to add data into a new column I have created in my
What I am trying to do is add a new {field:value} for a blog
I'm trying to add a new virtual field to my backbone model whenever a
For two days I have been trying to add new customer attribute to the

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.