Module: Voteable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/voteable_willem.rb
Overview
Using Concerns
Instance Method Summary collapse
Instance Method Details
#downvote ⇒ Object
18 19 20 |
# File 'lib/voteable_willem.rb', line 18 def downvote self.votes.where(vote: false).size end |
#total_votes ⇒ Object
10 11 12 |
# File 'lib/voteable_willem.rb', line 10 def total_votes self.upvote - self.downvote end |
#upvote ⇒ Object
14 15 16 |
# File 'lib/voteable_willem.rb', line 14 def upvote self.votes.where(vote: true).size end |