title: Get User ID from Devise, Ruby on Rails
body: <p>I use Devise and Basic HTTP Authentication to access user areas from a mobile app. When the user enters its details in the app and it tries to "login" (you don't actually login with basic auth as you send the credentials with each request) I want to get a response back with the user info, like user ID and email.</p>
  
  <p>When I try to get a resource I get a response like this:</p>
  
  <pre><code>[
   -
   {
      email: "em...@example.com"
      username: "Example"
   }
   -
    [
    -
    {
       created_at: "2011-07-26T11:30:55Z"
       id: 1
       title: "Test"
       updated_at: "2011-07-26T11:30:55Z"
       user_id: 1
    }
    -
    {
       created_at: "2011-07-26T16:53:26Z"
       id: 2
       title: "Test2"
       updated_at: "2011-07-26T16:53:26Z"
       user_id: 1
    }
   ]
  ]
  </code></pre>
  
  <p>So I get the user object at the beginning. However, I need to add the user ID as well. I can't use the user_id in the items because that won't be rendered if the user has no items.</p>
  
  <p>Any tips?</p>