Move question most voted answer from boolean to a enumerable max by total_votes

This commit is contained in:
Bertocq
2017-10-24 14:57:37 +02:00
committed by Javi Martín
parent 84eac6ff68
commit b8dbdaf9a7
4 changed files with 7 additions and 18 deletions

View File

@@ -13,9 +13,6 @@ class Polls::QuestionsController < ApplicationController
answer.touch if answer.persisted?
answer.save!
answer.record_voter_participation(token)
@question.question_answers.where(question_id: @question).each do |question_answer|
question_answer.set_most_voted
end
@answers_by_question_id = { @question.id => params[:answer] }
end