Class: Renalware::System::DownloadQuery
- Inherits:
-
Object
- Object
- Renalware::System::DownloadQuery
- Defined in:
- app/models/renalware/system/download_query.rb
Instance Attribute Summary collapse
-
#query_params ⇒ Object
readonly
Returns the value of attribute query_params.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(query_params) ⇒ DownloadQuery
constructor
A new instance of DownloadQuery.
- #search ⇒ Object
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_params ⇒ Object (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
#call ⇒ Object
14 15 16 |
# File 'app/models/renalware/system/download_query.rb', line 14 def call search.result.includes(:updated_by) end |
#search ⇒ Object
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 |