Module: Voteable

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

Instance Method Summary collapse

Instance Method Details

#down_voteObject



18
19
20
# File 'lib/voteable_cisolarix.rb', line 18

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

#total_voteObject



10
11
12
# File 'lib/voteable_cisolarix.rb', line 10

def total_vote
  up_vote - down_vote
end

#up_voteObject



14
15
16
# File 'lib/voteable_cisolarix.rb', line 14

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