Module: VoteableAms

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

Instance Method Summary collapse

Instance Method Details

#downvotesObject



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

def downvotes
  votes.reject(&:upvote).size
end

#upvotesObject



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

def upvotes
  votes.select(&:upvote).size
end

#vote_countObject



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

def vote_count
  upvotes - downvotes
end