Class: Workarea::BulkActionSelections

Inherits:
Object
  • Object
show all
Defined in:
app/queries/workarea/bulk_action_selections.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, params = {}) ⇒ BulkActionSelections

Returns a new instance of BulkActionSelections.



5
6
7
8
# File 'app/queries/workarea/bulk_action_selections.rb', line 5

def initialize(id, params = {})
  @bulk_action = BulkAction.find(id)
  @params = params
end

Instance Attribute Details

#bulk_actionObject (readonly)

Returns the value of attribute bulk_action.



3
4
5
# File 'app/queries/workarea/bulk_action_selections.rb', line 3

def bulk_action
  @bulk_action
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'app/queries/workarea/bulk_action_selections.rb', line 3

def params
  @params
end

Instance Method Details

#resultsObject



10
11
12
13
14
15
16
17
18
# File 'app/queries/workarea/bulk_action_selections.rb', line 10

def results
  @results ||=
    if bulk_action.ids.any?
      models = find_from_global_ids(bulk_action.ids)
      PagedArray.from(models, 1, models.size, models.size)
    else
      bulk_action.admin_query.class.new(query_params).results
    end
end