module Voteable

Public Instance Methods

down_vote() click to toggle source
# File lib/echan005_voting.rb, line 8
def down_vote
  votes.where(vote: false).length
end
total_votes() click to toggle source
# File lib/echan005_voting.rb, line 12
def total_votes
  up_votes - down_vote
end
up_votes() click to toggle source
# File lib/echan005_voting.rb, line 4
def up_votes
  votes.where(vote: true).length
end