Module: ActiveAdmin::Helpers::Collection
- Included in:
- Views::IndexList, Views::PaginatedCollection, Views::Scopes
- Defined in:
- lib/active_admin/helpers/collection.rb
Instance Method Summary collapse
Instance Method Details
#collection_is_empty?(c = collection) ⇒ Boolean
14 15 16 |
# File 'lib/active_admin/helpers/collection.rb', line 14 def collection_is_empty?(c = collection) collection_size(c) == 0 end |
#collection_size(c = collection) ⇒ Object
-
removes ‘select` and `order` to prevent invalid SQL
-
correctly handles the Hash returned when ‘group by` is used
6 7 8 9 10 11 12 |
# File 'lib/active_admin/helpers/collection.rb', line 6 def collection_size(c = collection) return c.count if c.is_a?(Array) c = c.except :select, :order c.group_values.present? ? c.count.count : c.count end |