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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:36:11+00:00 2026-05-20T06:36:11+00:00

I have added username to a devise authentication setup, and for some reason, it’s

  • 0

I have added username to a devise authentication setup, and for some reason, it’s not inserting the username into the database. The database puts NULL in the username field.

I have included code for the migration, and the form, as well as the production log that shows that it sent the actual username.

Here is what I did:

So I added a migration to add a username, which was successful:

class AddUsernameToUsers < ActiveRecord::Migration
  def self.up
    add_column :users, :username, :string
  end

  def self.down
    remove_column :users, :username
  end
end

I then edited app/views/devise/registrations/new.html.erb to include a text field for username:

<h2>Sign up</h2>

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
  <%= devise_error_messages! %>

  <p><%= f.label :username %><br />
  <%= f.text_field :username %></p>

  <p><%= f.label :email %><br />
  <%= f.text_field :email %></p>

  <p><%= f.label :password %><br />
  <%= f.password_field :password %></p>

  <p><%= f.label :password_confirmation %><br />
  <%= f.password_field :password_confirmation %></p>

  <p><%= f.submit "Sign up" %></p>
<% end %>

<%= render :partial => "devise/shared/links" %>

Here is the production log if that helps:

Started POST "/users" for 136.152.162.173 at Wed Feb 23 12:46:12 -0800 2011
  Processing by Devise::RegistrationsController#create as HTML
  Parameters: {"commit"=>"Sign up", "authenticity_token"=>"K8m6Em7IqSTFQG8aAYE4faUMsL2E46uNAllNTcsEF08=", "utf8"=>"?~\~S", "user"=>{"password_confirmation"=>"[FILTERED]", "username"=>"pyramation", "password"=>"[FILTERED]", "email"=>"dan@email.com"}}
Rendered devise/mailer/confirmation_instructions.html.erb (1.1ms)

Any help is greatly appreciated!

  • 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-20T06:36:12+00:00Added an answer on May 20, 2026 at 6:36 am

    Have you added :username to your attr_accessible list in your User model? e.g.:

    attr_accessible :email, :password, :password_confirmation, :username
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added an image into a MySql database. And I am trying to
I have added some code which compiles cleanly and have just received this Windows
I have added some dynamic textboxes upon a button click. I need the values
I have added some settings to my c# application using the configuration editor. There
I have a database structured as follows: users userid (Primary Key) username group groupid
My ASP.NET site is using Integrated Authentication with impersonation turned off. I have added
I have a Posts controller and I have just installed Devise to add some
I have been following this tutorial in order to get username authentication with transport
I have added the required assemblies and registered the NVelocityViewFactory in global.asax.cs page but
I have added multi-language using the short article below. When you add for example

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.