title: How to set up a resource specific root to the resource show page in Rails?
body: <p>My Rails 3.1 app has two user models: User and Admin. I'm using Devise.</p>
  
  <p>My routes.rb contains </p>
  
  <pre><code>root :to =&gt; "pages#welcome"
  </code></pre>
  
  <p>where users can login as a User or and Admin.</p>
  
  <p>Once logged in, the root path should change. The root for Admins should be "admins#dashboard", the root for Users should be the current user's show page.</p>
  
  <p>I'm having trouble working out how best to achieve this, and I have three questions.</p>
  
  <ol>
  <li>How do I define resource specific roots. I feel that I should be
  defining a 'user_root_path' and an "admin_root_path' but haven't been able to work out the
  syntax for this in my routes file?  </li>
  <li>How to I pass in the current user's ID so that I can root to the user's show page? </li>
  <li>How can I ensure that only a User or an Admin session can be active at any one
  time, and that users cannot login as both simultaneously?</li>
  </ol>
  
  <p>I would be very grateful for a pointer in the right direction, as this has got me stumped!</p>
  
  <p>Thank you. </p>