title: Rails: correct way of turning activerecord relation to array?
body: <p>I was trying to select objects uniq by one attribute, using <code>@videos.uniq{|p| p.author}</code></p>
  <pre><code>  time = Time.new(2014, 12)
    start_time = time.beginning_of_month
    end_time = time.end_of_month
  
    videos = Video.where(&quot;created_at &gt; ? AND created_at &lt; ?&quot;, start_time, end_time).where(&quot;likes &gt; ?&quot;, 15)
    selected_videos = videos.uniq{|p| p.author}
    puts videos.count, videos.class, selected_videos.count 
   #=&gt; 23, Video::ActiveRecord_Relation, 23
  
    videos_first = videos.first(23)
    selected_videos = videos_first.uniq{|p| p.author}
    puts videos_first.count, videos_first.class, selected_videos.count
    #=&gt; 23, array, 10
  </code></pre>
  <p><code>.uniq</code> is not for <code>ActiveRecord_Relation</code>. And the problem is that the query returns a <code>Video::ActiveRecord_Relation</code>, but I need <code>array</code>.</p>
  <p>Certainly, this could be achieved by using <code>to_a</code>, but is this elegant?</p>
  <ol>
  <li>What's the correct way of handling this ?</li>
  <li>Is it possible to use <code>.uniq</code> for <code>activerecord:relation</code>?</li>
  </ol>