title: How to add limit in group by query in rails?
body: <p>I want to fetch top 10 voters for a comment and add group by ?</p>
  
  <p>Sample response: </p>
  
  <pre><code>1 =&gt; [1,2,3,4,5,6,7,8,9,10],
  2 =&gt; [1,2,3,4]}
  </code></pre>
  
  <p>It should not exceed 10 voters.</p>
  
  <pre><code>  create_table "votes", force: :cascade do |t|
      t.integer  "user_id",      limit: 4,   null: false
      t.integer  "votable_id",   limit: 4,   null: false
      t.string   "votable_type", limit: 191, null: false
      t.integer  "weight",       limit: 4
    end
  
    create_table "comments", force: :cascade do |t|
      t.text     "message",          limit: 16777215,   null: false
      t.string   "type",             limit: 255
      t.integer  "commentable_id",   limit: 4
      t.string   "commentable_type", limit: 191
      t.integer  "user_id",          limit: 4,          null: false
    end
  
  </code></pre>
  
  <p>This is my query which returns all the voters. Instead I need to return top 10 voters for each comment.</p>
  
  <pre><code>Vote.where(votable_id: @comments_ids, votable_type: 'Comment').select(:votable_id, :user_id).group_by(&amp;:votable_id)
  </code></pre>