Class: SolidLoop::Admin::EventsQuery

Inherits:
BaseQuery
  • Object
show all
Defined in:
app/queries/solid_loop/admin/events_query.rb

Instance Attribute Summary

Attributes inherited from BaseQuery

#params, #scope

Instance Method Summary collapse

Constructor Details

#initialize(params, scope: SolidLoop::Event.order(created_at: :desc)) ⇒ EventsQuery

Returns a new instance of EventsQuery.



4
5
6
# File 'app/queries/solid_loop/admin/events_query.rb', line 4

def initialize(params, scope: SolidLoop::Event.order(created_at: :desc))
  super
end

Instance Method Details

#callObject



8
9
10
11
12
13
14
# File 'app/queries/solid_loop/admin/events_query.rb', line 8

def call
  filtered = scope
  filtered = filtered.where(loop_id: loop_id) if loop_id
  filtered = filtered.where(name: name) if name
  filtered = filtered.where(eventable_type: eventable_type) if eventable_type
  filtered
end