title: Rails5 and Devise: Login form for multiple models
body: <p>I have two models: <strong>user</strong> and <strong>employee_user</strong>, how can I setup a login form to authenticate two models at the same time? I need to login form check in what model he needs to authentiate the user</p>
  
  <p><strong>ApplicationHelper</strong></p>
  
  <pre><code>module ApplicationHelper
    def resource_name
      :user
    end
  
    def resource
      @resource ||= User.new
    end
  
    def devise_mapping
      @devise_mapping ||= Devise.mappings[:user]
    end
  end
  </code></pre>
  
  <p><strong>Form</strong></p>
  
  <pre><code>&lt;%= form_for(:user, :url =&gt; session_path(:user)) do |f| %&gt;
  
        &lt;%= f.email_field :email, required: true, placeholder: "Email" %&gt;
        &lt;%= f.password_field :password, autocomplete: :off, required: true, placeholder: "Password" %&gt;
  
        &lt;%= f.submit 'ENTER', class: "btLogin" %&gt;
  
        &lt;div class="infosLembrar"&gt;
          &lt;p&gt;&lt;%= f.check_box :remember_me %&gt; Remember me&lt;/p&gt;
        &lt;/div&gt;
  
      &lt;% end %&gt;
  </code></pre>
  
  <p>Someone already did it before? Thanks!</p>