title: How to force user to fill name while sign-up (devise)? [Rails 6]
body: <p>I have a problem with one of my first projects with Rails 6, I'm a newcomer and tried to deal with it for some days but nothing is working. <strong>I want to force an user to fill First name and Last name while sign-ing up</strong>. Previously I had set the name to display to Anonymous if someone doesn't provide names. It works for old users on my local acc but <strong>new user can sign-up and the name field is blank, why?</strong> I had set up that if there is no first or last name it should be anonymous...</p>
  <p>I have used <strong>devise gem for authentication</strong> to make a sign-up page with email and password that have to be filled. Then later I added two extra fields on my sign-up page for first name and last name by running:</p>
  <pre><code>class ApplicationController &lt; ActionController::Base
      before_action :authenticate_user!
      before_action :configure_permitted_parameters, if: :devise_controller?
  
      protected
  
      def configure_permitted_parameters
          devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])
          devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])
      end
  end
  </code></pre>
  <p><strong>added views</strong></p>
  <pre><code>
  &lt;div class=&quot;form-row&quot;&gt;
     &lt;div class=&quot;form-group col-md-6&quot;&gt;
          &lt;%= f.label :first_name %&gt;
          &lt;%= f.text_field :first_name, autofocus: true, autocomplete: 'first_name', class: 'form-control' %&gt;
     &lt;/div&gt;
  
     &lt;div class=&quot;form-group col-md-6&quot;&gt;
          &lt;%= f.label :last_name %&gt;
          &lt;%= f.text_field :last_name, autofocus: true, autocomplete: 'last_name', class: 'form-control' %&gt;
     &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  <p>I have added migration and run <strong>db:migrate</strong></p>
  <pre><code>  def change
      add_column :users, :first_name, :string
      add_column :users, :last_name, :string
    end
  </code></pre>
  <p>Before I had this model to display full name in navigation bar:</p>
  <pre><code>def full_name
    return &quot;#{first_name} #{last_name}&quot; if first_name || last_name
    &quot;Anonymous&quot;
  end
  
  &lt;li class='nav-item user-name'&gt;
    &lt;%= fa_icon 'user' %&gt; &lt;%= current_user.full_name %&gt;
  &lt;/li&gt;    
  </code></pre>