I haven't been able to find anything that works so far for ordering questions by number of upvotes using the acts_as_votable gem.
Here are my upvote and index methods:
def upvote
@question = Question.find params[:id]
@question.liked_by current_user
redirect_to comment_questions_path
end
def index
@comment = Comment.find params[:comment_id]
@questions = @comment.questions
end
and my questions view:
<%= div_for(question) do %>
<% if question.votes.size > 0 %>
<div class="verifiedanswer">
<%= question.body %>
</div>
<% else %>
<div class="answercontainer2">
<%= question.body %>
</div>
<% end %>
What should I put in the view and the controller to make this work?