Module: VoteableDarren
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/voteable_darren.rb
Instance Method Summary collapse
Instance Method Details
#down_votes ⇒ Object
24 25 26 |
# File 'lib/voteable_darren.rb', line 24 def down_votes self.votes.where(vote: false).size end |
#total_votes ⇒ Object
16 17 18 |
# File 'lib/voteable_darren.rb', line 16 def total_votes up_votes - down_votes end |
#up_votes ⇒ Object
20 21 22 |
# File 'lib/voteable_darren.rb', line 20 def up_votes self.votes.where(vote: true).size end |
#vote_display ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/voteable_darren.rb', line 8 def vote_display if self.total_votes == 1 || self.total_votes == -1 return " vote" else return " votes" end end |