title: Using one sign-in form with two Devise user models and different authentication methods
body: <p>I'm building a site that must support authentication both via LDAP, and with 'local' users that are managed in the site only.</p>
  
  <p>Currently I have the following Devise models:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  end
  
  class LdapUser &lt; User
    devise :ldap_authenticatable, :rememberable, :trackable
  end
  
  class LocalUser &lt; User
    devise :database_authenticatable, :registerable, :confirmable, :recoverable, :trackable
  end
  </code></pre>
  
  <p>Devise is generating routes that are separate for each of these, i.e. <code>/local_users/sign_in</code> and <code>/ldap_users/sign_in</code>. This isn't ideal, users shouldn't need to know which type of user they are, so I'd like to unify it all into one form, with one set of sign in/out URLs.</p>
  
  <p>I've looked at some solutions for how to do this, but they seem to rely on the fact that the models have the same Devise configuration, or the same authentication method.</p>
  
  <p>The only other example online of this sort of problem that I've found is this Google Groups thread: <a href="https://groups.google.com/forum/#!topic/plataformatec-devise/x7ZI6TsdI2E">https://groups.google.com/forum/#!topic/plataformatec-devise/x7ZI6TsdI2E</a> - which hasn't been answered.</p>