Class: CrudComponents::Admin::Dependents::Selection
- Inherits:
-
Object
- Object
- CrudComponents::Admin::Dependents::Selection
- Defined in:
- lib/crud_components/admin/dependents.rb
Overview
The same overview for several records at once: one item per association, counts summed, names taken across the selection.
Instance Method Summary collapse
- #blockers ⇒ Object
-
#initialize(records) ⇒ Selection
constructor
A new instance of Selection.
- #items ⇒ Object
Constructor Details
#initialize(records) ⇒ Selection
Returns a new instance of Selection.
31 |
# File 'lib/crud_components/admin/dependents.rb', line 31 def initialize(records) = @records = records |
Instance Method Details
#blockers ⇒ Object
38 |
# File 'lib/crud_components/admin/dependents.rb', line 38 def blockers = items.select(&:blocks?) |
#items ⇒ Object
33 34 35 36 |
# File 'lib/crud_components/admin/dependents.rb', line 33 def items @items ||= @records.flat_map { |record| Dependents.new(record).items } .group_by(&:name).map { |name, items| merged(name, items) } end |