title: Ruby on Rails 3 - to_json not including all attributes
body: <p>I'm using the <code>to_json</code> method on my model object that I created by doing something like:</p>
  
  <p><code>user = User.find(1)</code></p>
  
  <p>When I do <code>user.to_json</code>, a lot of attributes are missing, including <code>user.id</code> from the encoded JSON string. It appears that all of the attributes that I've added as attr_accessible from the User model are there, but none of the others. Perhaps that is what to_json is doing, but I think that adding <code>id</code> to attr_accessible is a no go. </p>
  
  <p>What is the right way of solving this problem?</p>
  
  <p><strong>UPDATE</strong> </p>
  
  <p>This looks to be a specific issue with Devise. If I comment out the following from user.rb, everything works as expected:</p>
  
  <p><code>devise :rememberable, :trackable, :token_authenticatable, :omniauthable</code></p>