Module: Queries::Concerns::PreparationTypes
- Extended by:
- ActiveSupport::Concern
- Included in:
- AnatomicalPart::Filter
- Defined in:
- lib/queries/concerns/preparation_types.rb
Overview
Helpers and facets for queries that reference PreparationTypes.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.merge_clauses ⇒ Object
56 57 58 59 60 61 |
# File 'lib/queries/concerns/preparation_types.rb', line 56 def self.merge_clauses [ :preparation_type_id_facet, :preparation_type_facet ] end |
.params ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/queries/concerns/preparation_types.rb', line 7 def self.params [ :preparation_type, :preparation_type_id, preparation_type_id: [], ] end |
Instance Method Details
#preparation_type_facet ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/queries/concerns/preparation_types.rb', line 46 def preparation_type_facet return nil if preparation_type.nil? if preparation_type referenced_klass.joins(:preparation_type).distinct else referenced_klass.where.missing(:preparation_type) end end |
#preparation_type_id_facet ⇒ Object
39 40 41 42 43 44 |
# File 'lib/queries/concerns/preparation_types.rb', line 39 def preparation_type_id_facet return nil if preparation_type_id.empty? referenced_klass.joins(:preparation_type) .where(preparation_type: { id: preparation_type_id }) end |