module ActiveAdmin::Helpers::Collection

def collection_is_empty?(c = collection)

def collection_is_empty?(c = collection)
  collection_size(c) == 0
end

def collection_size(c = collection)

2. correctly handles the Hash returned when `group by` is used
1. removes `select` and `order` to prevent invalid SQL
def collection_size(c = collection)
  return c.count if c.is_a?(Array)
  return c.length if c.limit_value
  c = c.except :select, :order
  c.group_values.present? ? c.count.count : c.count
end