Module: ActiveAdmin::Helpers::Collection
- Included in:
- Views::IndexList, Views::Pages::Index, 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
16 17 18 |
# File 'lib/active_admin/helpers/collection.rb', line 16 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
7 8 9 10 11 12 13 14 |
# File 'lib/active_admin/helpers/collection.rb', line 7 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 |