Module: Voteable

Extended by:
ActiveSupport::Concern
Defined in:
lib/voteable_ts.rb

Instance Method Summary collapse

Instance Method Details

#down_votesObject



15
16
17
# File 'lib/voteable_ts.rb', line 15

def down_votes
  self.votes.where(vote: false).size 
end

#total_votesObject



7
8
9
# File 'lib/voteable_ts.rb', line 7

def total_votes
  self.up_votes - self.down_votes
end

#up_votesObject



11
12
13
# File 'lib/voteable_ts.rb', line 11

def up_votes
  self.votes.where(vote: true).size
end