Class: Decidim::Elections::Trustees::ByParticipatorySpace
- Inherits:
-
Query
- Object
- Query
- Decidim::Elections::Trustees::ByParticipatorySpace
- Defined in:
- app/queries/decidim/elections/trustees/by_participatory_space.rb
Overview
A class used to find trustees by participatory space.
Instance Method Summary collapse
-
#initialize(participatory_space) ⇒ ByParticipatorySpace
constructor
Initializes the class.
-
#query ⇒ Object
Gets trustees by participatory space.
Constructor Details
#initialize(participatory_space) ⇒ ByParticipatorySpace
Initializes the class.
10 11 12 |
# File 'app/queries/decidim/elections/trustees/by_participatory_space.rb', line 10 def initialize(participatory_space) @participatory_space = participatory_space end |
Instance Method Details
#query ⇒ Object
Gets trustees by participatory space.
15 16 17 18 19 20 |
# File 'app/queries/decidim/elections/trustees/by_participatory_space.rb', line 15 def query Decidim::Elections::Trustee .includes([:user]) .joins(:trustees_participatory_spaces) .merge(Decidim::Elections::TrusteesParticipatorySpace.where(participatory_space: @participatory_space, considered: true)) end |