Module: AnswersHelper
- Defined in:
- app/helpers/answers_helper.rb
Overview
Provides helper methods for use by views under AnswersController
.
Instance Method Summary collapse
-
#my_vote(answer) ⇒ Vote?
Returns the current user’s vote for the specified post, or nil if no user is signed in.
Instance Method Details
#my_vote(answer) ⇒ Vote?
Returns the current user’s vote for the specified post, or nil if no user is signed in.
7 8 9 |
# File 'app/helpers/answers_helper.rb', line 7 def my_vote(answer) user_signed_in? ? answer.votes.where(user: current_user).first : nil end |