Module: QuestionsHelper
- Defined in:
- app/helpers/questions_helper.rb
Overview
Provides helper methods for use by views under QuestionsController
.
Instance Method Summary collapse
-
#my_vote(question) ⇒ Vote?
Returns the current user’s vote for the specified post, or nil if no user is signed in.
Instance Method Details
#my_vote(question) ⇒ 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/questions_helper.rb', line 7 def my_vote(question) user_signed_in? ? question.votes.where(user: current_user).first : nil end |