Class: Ballot::Vote
- Inherits:
-
Object
- Object
- Ballot::Vote
- Defined in:
- lib/ballot/vote.rb
Overview
A Vote represents the votes stored in the ballot_votes table, holding votes for Votable objects by Voter objects.
- ActiveRecord
-
This is implemented as the Ballot::ActiveRecord::Vote class.
- Sequel
-
This is implemented as the Ballot::Sequel::Vote class.
- NOTE
-
Ballot::Vote is implemented as a method returning the primary implementation of the vote class. If only Ballot::Sequel::Vote is defined, it will be returned. If only Ballot::ActiveRecord::Vote is defined, it will be returned. If both are defined,
nilwill be returned.
Class Method Summary collapse
-
.by_type(model_class) ⇒ Object
Returns all votes for Voter objects of the provided
model_class. -
.down ⇒ Object
Returns all negative votes.
-
.for_type(model_class) ⇒ Object
Returns all votes for Votable objects of the provided
model_class. -
.up ⇒ Object
Returns all positive votes.
Class Method Details
.by_type(model_class) ⇒ Object
Returns all votes for Voter objects of the provided model_class. The model_class is resolved to the canonical name for the model, which differs if the model is STI-enabled.
- ActiveRecord
-
This is a scope.
- Sequel
-
This is a dataset module method.
64 |
# File 'lib/ballot/vote.rb', line 64 def self.by_type(model_class); end |
.down ⇒ Object
Returns all negative votes.
- ActiveRecord
-
This is a scope.
- Sequel
-
This is a dataset module subset.
46 |
# File 'lib/ballot/vote.rb', line 46 def self.down; end |
.for_type(model_class) ⇒ Object
Returns all votes for Votable objects of the provided model_class. The model_class is resolved to the canonical name for the model, which differs if the model is STI-enabled.
- ActiveRecord
-
This is a scope.
- Sequel
-
This is a dataset module method.
55 |
# File 'lib/ballot/vote.rb', line 55 def self.for_type(model_class); end |
.up ⇒ Object
Returns all positive votes.
- ActiveRecord
-
This is a scope.
- Sequel
-
This is a dataset module subset.
39 |
# File 'lib/ballot/vote.rb', line 39 def self.up; end |