Module: VoteableDoug

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

Instance Method Summary collapse

Instance Method Details

#total_down_votesObject



16
17
18
# File 'lib/voteable_doug.rb', line 16

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

#total_up_votesObject



12
13
14
# File 'lib/voteable_doug.rb', line 12

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

#total_votesObject



8
9
10
# File 'lib/voteable_doug.rb', line 8

def total_votes
 total_up_votes - total_down_votes
end