Class: Decidim::Votings::Admin::BallotStyleByVotingCode
- Inherits:
-
Query
- Object
- Query
- Decidim::Votings::Admin::BallotStyleByVotingCode
- Defined in:
- app/queries/decidim/votings/admin/ballot_style_by_voting_code.rb
Overview
A class used to find trustees by participatory space.
Class Method Summary collapse
-
.for(voting, code) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(voting, code) ⇒ BallotStyleByVotingCode
constructor
Initializes the class.
-
#query ⇒ Object
Gets the ballot style with the specified code in this voting.
Constructor Details
#initialize(voting, code) ⇒ BallotStyleByVotingCode
Initializes the class.
17 18 19 20 |
# File 'app/queries/decidim/votings/admin/ballot_style_by_voting_code.rb', line 17 def initialize(voting, code) @voting = voting @code = code end |
Class Method Details
.for(voting, code) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
voting - the voting of the Ballot Style code - the code of the Ballot Style
12 13 14 |
# File 'app/queries/decidim/votings/admin/ballot_style_by_voting_code.rb', line 12 def self.for(voting, code) new(voting, code).query end |
Instance Method Details
#query ⇒ Object
Gets the ballot style with the specified code in this voting
23 24 25 26 27 |
# File 'app/queries/decidim/votings/admin/ballot_style_by_voting_code.rb', line 23 def query Decidim::Votings::BallotStyle .where(voting: @voting) .find_by(code: @code) end |