title: devise: sign up with username
body: <p>I create a <code>username</code> column in database. now I want remove <code>email</code> and then user <code>sign up</code> just by <code>username</code>. For this, I can create <code>username</code> field in <code>sign up</code> page, but again I have to complete email field that server create new user, if else, I get validation error of email field. <strong>How can I remove email validation and replace it with personal validation of username?</strong> and then user just can sign up with enter <code>username</code> and <code>password</code>?
  I have below code to:</p>
  
  <p><code>users_controller.rb</code>:</p>
  
  <pre><code>  def user_params
      params.require(:user).permit(:username, :email, :password, :password_confirmation, :remember_me)
    end
  </code></pre>
  
  <p><code>views/devise/registrations/new.html.erb</code>:</p>
  
  <pre><code>&lt;h2&gt;Sign up&lt;/h2&gt;
  
  &lt;%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %&gt;
    &lt;%= devise_error_messages! %&gt;
  
    &lt;div&gt;&lt;%= f.label :email %&gt;&lt;br /&gt;
    &lt;%= f.email_field :email, autofocus: true %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.label :username %&gt;&lt;br /&gt;
    &lt;%= f.email_field :username %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.label :password %&gt; &lt;% if @validatable %&gt;&lt;i&gt;(&lt;%= @minimum_password_length %&gt; characters minimum)&lt;/i&gt;&lt;% end %&gt;&lt;br /&gt;
      &lt;%= f.password_field :password, autocomplete: "off" %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.label :password_confirmation %&gt;&lt;br /&gt;
      &lt;%= f.password_field :password_confirmation, autocomplete: "off" %&gt;&lt;/div&gt;
  
    &lt;div&gt;&lt;%= f.submit "Sign up" %&gt;&lt;/div&gt;
  &lt;% end %&gt;
  
  &lt;%= render "user/shared/links" %&gt;
  </code></pre>