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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:46:38+00:00 2026-06-06T03:46:38+00:00

I have a question. Devise and mailboxer are installed on my rails app without

  • 0

I have a question.
Devise and mailboxer are installed on my rails app without any problem.

The problem is that you have to use “email” or “name” column to associate devise user with mailboxer.
Obviously, devise doesn’t have column called “name” in Users table.
So, if you use “email” then users will see everyone else’s email address that they wanna hide.

I want twitter-like registration.
They’ve got unique_id(account name) that never will be changed.
To achieve that, How can I?

I. Add column named “unique_id” to Users table?
command: rails g migration AddUniqueIdToUsers unique_id:string
to create migration file, and open and edit like this

class AddUniqueIdToUsers < ActiveRecord::Migration  
   def change  
    add_column :users, :unique_id, :string  
    add_index :users, :unique_id,  :unique => true  
   end 
end

II. How do I associate devise with mailboxer by using “unique_id” column?

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-06T03:46:40+00:00Added an answer on June 6, 2026 at 3:46 am

    Obviously, devise doesn’t have column called “name” in Users table

    That is entirely up to you, all Devise does (or wants you to do) is add a few records that tell it how to function. If you look at the devise generator you can see that all it does is add a couple of columns to your migration.

    I want twitter-like registration. They’ve got unique_id(account name) that never will be changed. To achieve that, How can I?

    First of all, a unique ID is always given to you by free in Rails (indeed, in most typical web applications using a database backend, each row has a unique ID).

    But, if you also want users to select a username, and have that be unique as well, the you could do as the mailboxer readme states and simply override the usage of name with your own database column like username, like so:

    Mailboxer.setup do |config|
      # ...
      #Configures the methods needed by mailboxer
      config.email_method = :email
      config.name_method = :username
      # ...
    end
    

    Or, if you want to stay out of the mailboxer config file, you can simply use alias_method and do this (given that you have a username column):

    class User < ActiveRecord::Base
      alias_method :name, :username
      acts_as_messageable
    end
    

    Either way, Devise doesn’t restrict you in which columns you use on your User model, and it seems that Mailboxer also doesn’t restrict you in which columns you use to attach the gem to the User model. So you have as much flexibility as you want without having to built this functionality by yourself.

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

Sidebar

Related Questions

I have a rails 3 app that is currently using Devise for authentication. I
I have an app that is using devise for authentication. Rails 3 on ruby
I have one question about C2DM, I registered yesterday and I got email that
I have a Rails site that uses Devise for authentication. I have one page
I have come up with another question.I am trying to devise a MySql query.
Simple question, what are some good free mobile device detection scripts that people have
I have question regarding the use of function parameters. In the past I have
I am new to rails and have a question regarding the plugins. It seems
I have a rails application, and I authenticate users to the application using Devise.
I am learning Ruby on Rails and I have a dumb question about 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.