Module: Voteable
- Defined in:
- lib/echan005_voting.rb
Instance Method Summary collapse
Instance Method Details
#down_vote ⇒ Object
8 9 10 |
# File 'lib/echan005_voting.rb', line 8 def down_vote votes.where(vote: false).length end |
#total_votes ⇒ Object
12 13 14 |
# File 'lib/echan005_voting.rb', line 12 def total_votes up_votes - down_vote end |
#up_votes ⇒ Object
4 5 6 |
# File 'lib/echan005_voting.rb', line 4 def up_votes votes.where(vote: true).length end |