title: Rails - Map Function Alternative to Return Object
body: <p>I have this line in the index action of my controller:</p>
  
  <pre><code>@orders = Order.all.map{|k| k.transaction}.keep_if{ |a| a != nil }
  </code></pre>
  
  <p>The problem is, <code>@orders</code> is returning an array. I need @orders to be Object like <code>Order.all</code> to use it properly with <code>will_paginate</code> and <code>pundit</code> GEMS.</p>
  
  <p>Is there any object returning alternative of <code>map</code> method?</p>
  
  <p>Thanks in advance.</p>