title: Get specific attributes from an ActiveRecord model
body: <p>Let's say that I have a <code>User</code> model with attributes <code>:id, :first_name, :last_name, and :email</code>. In my application, guest users shouldn't see <code>User's email and last_name</code>. I know how to select specific values if I want a list of users but I don't know how I can get specific attributes of a specific user like </p>
  
  <pre><code>User.find_by(id: 5).select(:id, :first_name).
  </code></pre>
  
  <p>One solution to that is to user</p>
  
  <pre><code>User.find_by(id: 5).attributes.slice('id', 'first_name') 
  </code></pre>
  
  <p>but then I get a hash instead of an AR record. I could do</p>
  
  <pre><code>User.select(:id, :first_name).find_by(id: 1) 
  </code></pre>
  
  <p>but the thing that I don't know which filters I should filter since I need to know the user first.</p>
  
  <p>Could you help me?</p>