Class: Decidim::Votings::Votes::InPersonVoteForVoter
- Inherits:
-
Query
- Object
- Query
- Decidim::Votings::Votes::InPersonVoteForVoter
- Defined in:
- app/queries/decidim/votings/votes/in_person_vote_for_voter.rb
Overview
A class used to find a non-rejected in person vote registered for a voter in an election
Class Method Summary collapse
-
.for(election, voter_id) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(election, voter_id) ⇒ InPersonVoteForVoter
constructor
A new instance of InPersonVoteForVoter.
- #query ⇒ Object
Constructor Details
#initialize(election, voter_id) ⇒ InPersonVoteForVoter
Returns a new instance of InPersonVoteForVoter.
16 17 18 19 |
# File 'app/queries/decidim/votings/votes/in_person_vote_for_voter.rb', line 16 def initialize(election, voter_id) @voter_id = voter_id @election = election end |
Class Method Details
.for(election, voter_id) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
election - the election where the vote was casted voter_id - the identifier of the voter
12 13 14 |
# File 'app/queries/decidim/votings/votes/in_person_vote_for_voter.rb', line 12 def self.for(election, voter_id) new(election, voter_id).query end |
Instance Method Details
#query ⇒ Object
21 22 23 |
# File 'app/queries/decidim/votings/votes/in_person_vote_for_voter.rb', line 21 def query Decidim::Votings::InPersonVote.not_rejected.find_by(election: @election, voter_id: @voter_id) end |