title: Rails, Devise multiple models login and their sessions
body: <p>I have two models that are generated by <strong>devise</strong>: <code>Partner</code> and <code>Admin</code>. Each of them has their own <code>sessions currents and etc</code>. Some controllers require only <code>Admin</code> that logged in, some controllers require either <code>Partner</code> or <code>Admin</code> to be logged in.</p>
  
  <p>There is <code>:authenticate_admin!</code> and <code>:authenticate_partner!</code> methods that will be called in my controllers <code>before_action</code>.</p>
  
  <p>I also use <strong>CanCanCan</strong> to define both of them roles.</p>
  
  <p>That gives multiple questions:</p>
  
  <ol>
  <li>If I logged in as <code>Partner</code> then I opened page where <code>Admin</code> must be logged in and I logged in, that means that I will have two <code>sessions</code> at once?</li>
  <li>I logged in as <code>Partner</code> when I am also <code>Admin</code>, that mens I need to destroy session of <code>Admin</code>. How to make Devise to destroy other model sessions when current model is logged in?</li>
  <li><p>Do I need to add something like this in controller where or <code>Admin</code> or <code>Partner</code> is needed?</p>
  
  <pre><code>before_action :authenticate_partner!
  before_action :authenticate_admin!
  </code></pre></li>
  <li><p>And the last question is: how I can make <code>Partners</code> open pages (that means access controllers) only that is allowed by <strong>CanCanCan</strong> ? </p></li>
  </ol>
  
  <p>I wanted to use <code>authorize_resource</code>, it asks only one model per controller.</p>