Class: Renalware::System::DownloadQuery

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/system/download_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query_params) ⇒ DownloadQuery

Returns a new instance of DownloadQuery.



10
11
12
# File 'app/models/renalware/system/download_query.rb', line 10

def initialize(query_params)
  @query_params = query_params || {}
end

Instance Attribute Details

#query_paramsObject (readonly)

Returns the value of attribute query_params.



8
9
10
# File 'app/models/renalware/system/download_query.rb', line 8

def query_params
  @query_params
end

Instance Method Details

#callObject



14
15
16
# File 'app/models/renalware/system/download_query.rb', line 14

def call
  search.result.includes(:updated_by)
end

#searchObject



18
19
20
# File 'app/models/renalware/system/download_query.rb', line 18

def search
  @search ||= Download.order(view_count: :desc, name: :asc).ransack(query_params)
end