Class: Renalware::Clinics::AppointmentQuery
- Inherits:
-
Object
- Object
- Renalware::Clinics::AppointmentQuery
- Defined in:
- app/models/renalware/clinics/appointment_query.rb
Defined Under Namespace
Classes: QueryableAppointment
Instance Attribute Summary collapse
-
#appointments ⇒ Object
readonly
Returns the value of attribute appointments.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(q = {}) ⇒ AppointmentQuery
constructor
A new instance of AppointmentQuery.
- #search ⇒ Object
Constructor Details
#initialize(q = {}) ⇒ AppointmentQuery
Returns a new instance of AppointmentQuery.
10 11 12 13 |
# File 'app/models/renalware/clinics/appointment_query.rb', line 10 def initialize(q = {}) @q = q @q[:s] = "starts_at ASC" if @q[:s].blank? end |
Instance Attribute Details
#appointments ⇒ Object (readonly)
Returns the value of attribute appointments.
8 9 10 |
# File 'app/models/renalware/clinics/appointment_query.rb', line 8 def appointments @appointments end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
8 9 10 |
# File 'app/models/renalware/clinics/appointment_query.rb', line 8 def query @query end |
Instance Method Details
#call ⇒ Object
15 16 17 |
# File 'app/models/renalware/clinics/appointment_query.rb', line 15 def call search.result.includes(:user, :clinic, patient: [current_modality: [:description]]) end |
#search ⇒ Object
19 20 21 |
# File 'app/models/renalware/clinics/appointment_query.rb', line 19 def search @search ||= QueryableAppointment.ransack(@q) end |