title: Adding Username to devise rails 4
body: <p>I have a rails 4 application using devise. I'm trying to allow users to have a username associated with them.</p>
  
  <p>I've added a username (string) column to the Users table, and had my Application controller look like this:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
  
      before_filter :configure_permitted_parameters, if: :devise_controller?
      protect_from_forgery with: :exception
      protected
      def configure_permitted_parameters
         devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email) }
      end
  
  end
  </code></pre>
  
  <p>and I've also added a field for the username on the users/sign_up page.</p>
  
  <p>But I get this error:</p>
  
  <pre><code>undefined local variable or method `devise_parameter_sanitizer' for #&lt;Devise::RegistrationsController:0x00000101378a28&gt;
  </code></pre>
  
  <p>So basically my question is why is this error appearing, or how else can I get a user to get a username?</p>
  
  <p>Thanks for all help!</p>