Module: Voteable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/voteable_nancy.rb
Instance Method Summary collapse
Instance Method Details
#downvotes ⇒ Object
17 18 19 |
# File 'lib/voteable_nancy.rb', line 17 def downvotes self.votes.where(vote: false).size end |
#total_votes ⇒ Object
9 10 11 |
# File 'lib/voteable_nancy.rb', line 9 def total_votes self.upvotes - self.downvotes end |
#upvotes ⇒ Object
13 14 15 |
# File 'lib/voteable_nancy.rb', line 13 def upvotes self.votes.where(vote: true).size end |