Class: Lcms::Engine::AdminMaterialsQuery

Inherits:
BaseQuery
  • Object
show all
Defined in:
app/queries/lcms/engine/admin_materials_query.rb

Overview

Usage:

@materials = AdminMaterialsQuery.call(query_params, page: params[:page])

Constant Summary collapse

STRICT_METADATA =
%w(grade subject).freeze

Instance Method Summary collapse

Methods inherited from BaseQuery

call, #initialize

Constructor Details

This class inherits a constructor from Lcms::Engine::BaseQuery

Instance Method Details

#callObject

Returns: ActiveRecord relation



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/queries/lcms/engine/admin_materials_query.rb', line 11

def call
  @scope = Material.all # initial scope
  search_by_identifier
  search_by_file_name

  

  if @pagination.present?
    sorted_scope.paginate(page: @pagination[:page])
  else
    sorted_scope
  end
end