Module: Voteable

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

Instance Method Summary collapse

Instance Method Details

#downvotesObject



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

def downvotes
  votes.where(vote: false).size
end

#total_votesObject



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

def total_votes
  upvotes - downvotes
end

#upvotesObject



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

def upvotes
  votes.where(vote: true).size
end