title: Devise how to add a addtional field to the create User form?
body: <p>I am trying to add a username to my User on create.</p>
  
  <p>In devise/registrations/new I have:</p>
  
  <pre><code>&lt;h2&gt;Sign up&lt;/h2&gt;
  
  &lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; registration_path(resource_name)) do |f| %&gt;
    &lt;%= devise_error_messages! %&gt;
    &lt;p&gt;&lt;%= f.label :username %&gt;&lt;br /&gt;
    &lt;%= f.text_field :username %&gt;&lt;/p&gt;
  
    &lt;p&gt;&lt;%= f.label :email %&gt;&lt;br /&gt;
    &lt;%= f.email_field :email %&gt;&lt;/p&gt;
  
    &lt;p&gt;&lt;%= f.label :password %&gt;&lt;br /&gt;
    &lt;%= f.password_field :password %&gt;&lt;/p&gt;
  
    &lt;p&gt;&lt;%= f.label :password_confirmation %&gt;&lt;br /&gt;
    &lt;%= f.password_field :password_confirmation %&gt;&lt;/p&gt;
  
    &lt;p&gt;&lt;%= f.submit "Sign up" %&gt;&lt;/p&gt;
  &lt;% end %&gt;
  
  &lt;%= render :partial =&gt; "devise/shared/links" %&gt;
  </code></pre>
  
  <p>The problem is there is no <code>params[:username]</code> sent to the controller and I get the following error in the view:</p>
  
  <pre><code>ActiveRecord::StatementInvalid in Devise::RegistrationsController#create
  
  Mysql::Error: Column 'username' cannot be null:
    INSERT INTO `users` (`email`, `encrypted_password`, `reset_password_token`,
    `reset_password_sent_at`, `remember_created_at`, `sign_in_count`,
    `current_sign_in_at`, `last_sign_in_at`, `current_sign_in_ip`, `last_sign_in_ip`,
    `created_at`, `updated_at`, `username`) VALUES ('mail@test.dk',
    '$2a$10$bWjAXLY8QGXrXeVrGciv2O6mjRF940lajBEsUOPPtPDhKyj0A/gia', NULL, NULL,
    NULL, 0, NULL, NULL, NULL, NULL, '2011-05-15 16:16:36', '2011-05-15 16:16:36',
    NULL)
  
  Rails.root: C:/Rails/densjove
  Application Trace | Framework Trace | Full Trace
  
  Request
  
  Parameters:
  
  {"utf8"=&gt;"✓",
   "authenticity_token"=&gt;"qkQ8L0ZonXYxWQ2f4cfdREZ222oa2zGUb/qll3TRxjQ=",
   "user"=&gt;{"username"=&gt;"hansen",
   "email"=&gt;"mail@test.dk",
   "password"=&gt;"[FILTERED]",
   "password_confirmation"=&gt;"[FILTERED]"},
   "commit"=&gt;"Sign up"}
  </code></pre>
  
  <p>I have added the <code>username</code> coloumn to my model, but how can I access the <code>params[:username]</code> in my controller?</p>