Module: Voteable

Defined in:
lib/voteable-eobrien.rb

Overview

Assumes votes association with a boolean ‘vote’ column

Instance Method Summary collapse

Instance Method Details

#total_votesObject



3
4
5
# File 'lib/voteable-eobrien.rb', line 3

def total_votes
  self.votes.where(vote: true).size - self.votes.where(vote: false).size
end