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