Issue with mering ActiveRecord query results

class ABC
def self.
    active'starts_at <= ?','(ends_at > ? || ends_at IS NULL)',


  def self.recently_completed
self.completed.where("completed_at > ?", 2.days.ago)`


The issue is when I do:

( + ABC.recently_completed).columns_hash

This gives error, undefined method `columns_hash’ for #<Array:…

When I do:


The query being run is actually combination of the two. They are not run independently as I expected.

I need a way to write the code as to run the queries separately and then merge the results but not as an array.

If you were going to use Hash#merge to remove duplicates between the two result sets, you might as well just use Array#uniq on the Array.


It isn’t Hash#merge, but ActiveRecord::SpawnMethods#merge