Module: VoteableMinh::InstanceMethods

Defined in:
lib/voteable_minh.rb

Instance Method Summary collapse

Instance Method Details

#down_voteObject



19
20
21
# File 'lib/voteable_minh.rb', line 19

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

#up_voteObject



15
16
17
# File 'lib/voteable_minh.rb', line 15

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

#vote_countObject



11
12
13
# File 'lib/voteable_minh.rb', line 11

def vote_count
up_vote-down_vote
end