module ActiveAdmin::Helpers::Collection
Public Instance Methods
collection_is_empty?(collection=collection)
click to toggle source
# File lib/active_admin/helpers/collection.rb, line 18 def collection_is_empty?(collection=collection) collection_size(collection) == 0 end
collection_size(collection=collection)
click to toggle source
Works around this issue: github.com/rails/rails/issues/7121
GROUP BY + COUNT drops SELECT statement. This leads to SQL error when the ORDER statement mentions a column defined in the SELECT statement.
We remove the ORDER statement to work around this issue.
# File lib/active_admin/helpers/collection.rb, line 10 def collection_size(collection=collection) if collection.group_values.present? collection.reorder("").count # is a Hash else collection end.count end