Class: Ballot::Vote

Inherits:
Object
  • Object
show all
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, nil will be returned.

Class Method Summary collapse

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

.downObject

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

.upObject

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