Class: Decidim::ActionDelegator::ConsultationDelegations

Inherits:
Query
  • Object
show all
Defined in:
app/queries/decidim/action_delegator/consultation_delegations.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(consultation) ⇒ ConsultationDelegations

Returns a new instance of ConsultationDelegations.



10
11
12
# File 'app/queries/decidim/action_delegator/consultation_delegations.rb', line 10

def initialize(consultation)
  @consultation = consultation
end

Class Method Details

.for(consultation) ⇒ Object



6
7
8
# File 'app/queries/decidim/action_delegator/consultation_delegations.rb', line 6

def self.for(consultation)
  new(consultation).query
end

Instance Method Details

#queryObject



14
15
16
17
18
# File 'app/queries/decidim/action_delegator/consultation_delegations.rb', line 14

def query
  Delegation
    .joins(setting: :consultation)
    .where(decidim_consultations: { id: consultation.id })
end