Fixes rails autoloader error in development

This commit is contained in:
kikito
2017-01-29 22:53:32 +01:00
parent 55ace74c67
commit 964da1e6d6

View File

@@ -4,6 +4,8 @@ class PollsController < ApplicationController
has_filters %w{current expired incoming}
::Poll::Answer # trigger autoload
def index
@polls = @polls.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page])
end
@@ -12,7 +14,7 @@ class PollsController < ApplicationController
@questions = @poll.questions.for_render.sort_for_list
@answers_by_question_id = {}
poll_answers = Poll::Answer.by_question(@poll.question_ids).by_author(current_user.try(:id))
poll_answers = ::Poll::Answer.by_question(@poll.question_ids).by_author(current_user.try(:id))
poll_answers.each do |answer|
@answers_by_question_id[answer.question_id] = answer.answer
end