Module: Voteable

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

Instance Method Summary collapse

Instance Method Details

#number_of_down_votesObject



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

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

#number_of_up_votesObject



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

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

#number_of_votesObject



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

def number_of_votes
  number_of_up_votes - number_of_down_votes
end