module Voteable

using concerns (it's a rails thing)

Public Instance Methods

diff_votes() click to toggle source
# File lib/voteable_rockstar.rb, line 9
def diff_votes
  self.up_votes - self.down_votes
end
down_votes() click to toggle source
# File lib/voteable_rockstar.rb, line 17
def down_votes
  self.votes.where(vote: false).size
end
up_votes() click to toggle source
# File lib/voteable_rockstar.rb, line 13
def up_votes
  self.votes.where(vote: true).size
end