Module: VoteableTj::InstanceMethods
- Defined in:
- lib/voteable-tj.rb
Instance Method Summary collapse
Instance Method Details
#already_voted_on?(obj) ⇒ Boolean
25 26 27 |
# File 'lib/voteable-tj.rb', line 25 def already_voted_on?(obj) self.votes.where(voteable: obj).size > 0 end |
#down_votes ⇒ Object
21 22 23 |
# File 'lib/voteable-tj.rb', line 21 def down_votes self.votes.where(vote: false).size end |
#total_votes ⇒ Object
13 14 15 |
# File 'lib/voteable-tj.rb', line 13 def total_votes self.votes.where(vote: true).size - self.votes.where(vote: false).size end |
#up_votes ⇒ Object
17 18 19 |
# File 'lib/voteable-tj.rb', line 17 def up_votes self.votes.where(vote: true).size end |