Class: Decidim::ActionDelegator::Responses
- Inherits:
-
Query
- Object
- Query
- Decidim::ActionDelegator::Responses
- Defined in:
- app/queries/decidim/action_delegator/responses.rb
Instance Method Summary collapse
-
#initialize(consultation) ⇒ Responses
constructor
A new instance of Responses.
-
#query ⇒ Object
The Question’s default_scope, ‘order(order: :asc)`, messes up the ordering in our queries so we have to explicitly remove the ORDER BY close using `#reorder`.
Constructor Details
#initialize(consultation) ⇒ Responses
Returns a new instance of Responses.
6 7 8 |
# File 'app/queries/decidim/action_delegator/responses.rb', line 6 def initialize(consultation) @consultation = consultation end |
Instance Method Details
#query ⇒ Object
The Question’s default_scope, ‘order(order: :asc)`, messes up the ordering in our queries so we have to explicitly remove the ORDER BY close using `#reorder`.
12 13 14 15 16 17 |
# File 'app/queries/decidim/action_delegator/responses.rb', line 12 def query Decidim::Consultations::Response .joins(question: :consultation) .where(decidim_consultations_questions: { decidim_consultation_id: consultation.id }) .where.not(decidim_consultations_questions: { published_at: nil }) end |