Module: Voteable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/voteable_ramky.rb
Instance Method Summary collapse
Instance Method Details
#down_votes ⇒ Object
17 18 19 |
# File 'lib/voteable_ramky.rb', line 17 def down_votes self.votes.where(vote: :false).size end |
#total_votes ⇒ Object
8 9 10 11 |
# File 'lib/voteable_ramky.rb', line 8 def total_votes votes = up_votes - down_votes votes.to_s + ( [-1,0,1].include?(votes) ? ' Vote' : ' Votes' ) end |
#up_votes ⇒ Object
13 14 15 |
# File 'lib/voteable_ramky.rb', line 13 def up_votes self.votes.where(vote: :true).size end |