title: ActiveModel::ForbiddenAttributesError while using devise for registration
body: <p>I am using devise to register my users. I am customizing the create action of the registration controller, however whenever I try to create any new user it is refused and I get the mentioned error. I know I have to permit the params needed and I do so I don't understand why I keep getting the error. Below are my trials thus far.</p>
  
  <pre><code>#user model
  class User &lt; ActiveRecord::Base
      devise :database_authenticatable, :registerable,
       :recoverable, :rememberable, :trackable, :validatable, :confirmable
      belongs_to :country
      #rest of the code
  end
  
  ## Custom registeration controller
  class RegistrationsController &lt; Devise::RegistrationsController
      def create
          @user = User.new(params[:user])
          if @user.save
              sign_in(@user, bypass: true)
              redirect_to user_employee_steps_path(@user),
      notice: 'A confirmation email was sent to your email, please complete your profile
              and confirm your account to start looking for potential employees'
          else
              render 'new'
          end
      end
  end
  
  #new.html.erb the view for the registration sign up
  &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 :first_name %&gt;&lt;br /&gt;
      &lt;%= f.text_field :first_name %&gt;&lt;/div&gt;
  
      &lt;div&gt;&lt;%= f.label :last_name %&gt;&lt;br /&gt;
      &lt;%= f.text_field :last_name %&gt;&lt;/div&gt;
  
      &lt;div&gt;&lt;%= f.label :dob, "Birthday" %&gt;&lt;br /&gt;
      &lt;%= f.date_select :dob, start_year: 1900, end_year: Time.now.year - 18 %&gt;&lt;/div&gt;
  
      &lt;div&gt;&lt;%= f.label :country_id, "Country" %&gt;&lt;br /&gt;
      &lt;%= f.select :country_id, Country.order(name: :asc).collect { |country| [country.name, country.id] }, prompt: 'Select your country' %&gt;&lt;/div&gt;
  
      &lt;div&gt;&lt;%= f.label :city %&gt;&lt;br /&gt;
      &lt;%= f.text_field :city %&gt;&lt;/div&gt;
  
      &lt;div&gt;&lt;%= f.label :password %&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 "users/shared/links" %&gt;
  
  #application controller where I permit params for sign up
  class ApplicationController &lt; ActionController::Base
      before_action :configure_permitted_parameters, if: :devise_controller?
  
      protected
  
      def configure_permitted_parameters
          puts '%' * 30
          devise_parameter_sanitizer.for(:sign_up) &lt;&lt; [:first_name, :last_name, :country_id, :city, :dob]
          puts devise_parameter_sanitizer.for(:sign_up)
          puts '%' * 30
      end
  end
  </code></pre>
  
  <p>Now whenever I create a new user I get the mentioned error in the title, and the result of the puts statement that's being published is as follows:</p>
  
  <pre><code>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  email
  password
  password_confirmation
  first_name
  last_name
  country_id
  city
  dob
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  </code></pre>
  
  <p>which means that the method configure_permitted_parameters was called correctly, and the required params should be already there, so I do not understand where the problem might be?! I am really stuck on this and any help would be appreciated.</p>