Class: Decidim::Elections::Votes::LastVoteForVoter
- Inherits:
-
Query
- Object
- Query
- Decidim::Elections::Votes::LastVoteForVoter
- Defined in:
- app/queries/decidim/elections/votes/last_vote_for_voter.rb
Overview
A class used to find the last vote casted by 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) ⇒ LastVoteForVoter
constructor
A new instance of LastVoteForVoter.
- #query ⇒ Object
Constructor Details
#initialize(election, voter_id) ⇒ LastVoteForVoter
Returns a new instance of LastVoteForVoter.
16 17 18 19 |
# File 'app/queries/decidim/elections/votes/last_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/elections/votes/last_vote_for_voter.rb', line 12 def self.for(election, voter_id) new(election, voter_id).query end |