Module: VoteFu::Concerns::Voter::ClassMethods
- Defined in:
- lib/vote_fu/concerns/voter.rb
Instance Method Summary collapse
-
#voted_on(voteable, direction: nil, scope: nil) ⇒ Object
Find voters who voted on a specific item.
Instance Method Details
#voted_on(voteable, direction: nil, scope: nil) ⇒ Object
Find voters who voted on a specific item
117 118 119 120 121 122 123 |
# File 'lib/vote_fu/concerns/voter.rb', line 117 def voted_on(voteable, direction: nil, scope: nil) votes = VoteFu::Vote.where(voteable: voteable).with_scope(scope) votes = votes.up if direction == :up votes = votes.down if direction == :down where(id: votes.where(voter_type: name).select(:voter_id)) end |