Module: Queries::Concerns::Polymorphic
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/queries/concerns/polymorphic.rb
Overview
Used to handle params from shallow routes like /otus/123/data_attributes These translate to `otu_id: 123`. !! Only include in annotating filters.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.and_clauses ⇒ Object
43 44 45 |
# File 'lib/queries/concerns/polymorphic.rb', line 43 def self.and_clauses [ :polymorphic_id_facet ] end |
.params ⇒ Object
7 8 9 10 11 12 |
# File 'lib/queries/concerns/polymorphic.rb', line 7 def self.params [ # :polymorphic_id, # :polymorphic_type ] end |
Instance Method Details
#polymorphic_id_facet ⇒ Object
38 39 40 41 |
# File 'lib/queries/concerns/polymorphic.rb', line 38 def polymorphic_id_facet return nil if polymorphic_id.blank? table[referenced_klass.annotator_id].eq(polymorphic_id).and(table[referenced_klass.annotator_type].eq(polymorphic_type)) end |