Class: Renalware::Transplants::LiveDonorsQuery
- Inherits:
-
Object
- Object
- Renalware::Transplants::LiveDonorsQuery
- Includes:
- ModalityScopes
- Defined in:
- app/models/renalware/transplants/live_donors_query.rb
Constant Summary collapse
- DEFAULT_ORDER =
%w(family_name given_name).freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(q = {}) ⇒ LiveDonorsQuery
constructor
A new instance of LiveDonorsQuery.
- #search ⇒ Object
Methods included from ModalityScopes
#with_current_modality_matching, #with_current_modality_of_class
Constructor Details
#initialize(q = {}) ⇒ LiveDonorsQuery
Returns a new instance of LiveDonorsQuery.
9 10 11 |
# File 'app/models/renalware/transplants/live_donors_query.rb', line 9 def initialize(q = {}) @q = q end |
Instance Method Details
#call ⇒ Object
13 14 15 |
# File 'app/models/renalware/transplants/live_donors_query.rb', line 13 def call search.result end |
#search ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/models/renalware/transplants/live_donors_query.rb', line 17 def search @search ||= begin relation.ransack(q).tap do |search| search.sorts = DEFAULT_ORDER end end end |