Class: Renalware::Pathology::Requests::RequestQuery
- Inherits:
-
Object
- Object
- Renalware::Pathology::Requests::RequestQuery
- Defined in:
- app/models/renalware/pathology/requests/request_query.rb
Defined Under Namespace
Classes: QueryableRequest
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#requests ⇒ Object
readonly
Returns the value of attribute requests.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(q = {}) ⇒ RequestQuery
constructor
A new instance of RequestQuery.
- #search ⇒ Object
Constructor Details
#initialize(q = {}) ⇒ RequestQuery
Returns a new instance of RequestQuery.
11 12 13 14 |
# File 'app/models/renalware/pathology/requests/request_query.rb', line 11 def initialize(q = {}) @q = q @q[:s] = "created_at DESC" if @q[:s].blank? end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
9 10 11 |
# File 'app/models/renalware/pathology/requests/request_query.rb', line 9 def query @query end |
#requests ⇒ Object (readonly)
Returns the value of attribute requests.
9 10 11 |
# File 'app/models/renalware/pathology/requests/request_query.rb', line 9 def requests @requests end |
Instance Method Details
#call ⇒ Object
16 17 18 |
# File 'app/models/renalware/pathology/requests/request_query.rb', line 16 def call search.result.includes(:patient, :clinic, :consultant) end |
#search ⇒ Object
20 21 22 |
# File 'app/models/renalware/pathology/requests/request_query.rb', line 20 def search @search ||= QueryableRequest.ransack(@q) end |