title: Rails select distinct
body: <p>in a scenario i want to retrieve the records with different values so i used distinct for that, </p>
  
  <blockquote>
    <p>Book.where(["user_id = ?",@user_id]).select('distinct title_id')</p>
  
  <pre><code>`this, only retrives the records like this [#&lt;Book title_id: 30&gt;, #&lt;Book title_id: 31&gt; ]`
  </code></pre>
  </blockquote>
  
  <p>but i want to fetch the id of Book as well along with title_id</p>
  
  <p>so, please advise me how to work on this</p>
  
  <p>thanks</p>