diff --git a/app/controllers/polls/questions_controller.rb b/app/controllers/polls/questions_controller.rb index 4ab83332b..a48c1e194 100644 --- a/app/controllers/polls/questions_controller.rb +++ b/app/controllers/polls/questions_controller.rb @@ -11,8 +11,8 @@ class Polls::QuestionsController < ApplicationController @comment_tree = CommentTree.new(@commentable, params[:page], @current_order) set_comment_flags(@comment_tree.comments) - #@question_answer = @question.answers.where(author_id: current_user.try(:id)).first - @answers_by_question_id = {@question.id => params[:answer]} + question_answer = @question.partial_results.where(author_id: current_user.try(:id)).first + @answers_by_question_id = {@question.id => question_answer.try(:answer)} end def answer diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index 350f19eae..7964727be 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -47,8 +47,7 @@ class Poll::Question < ActiveRecord::Base end def answerable_by?(user) - true - #poll.answerable_by?(user) && (self.all_geozones || self.geozone_ids.include?(user.geozone_id)) + poll.answerable_by?(user) && (self.all_geozones || self.geozone_ids.include?(user.geozone_id)) end def self.answerable_by(user) diff --git a/app/views/polls/questions/_answers.html.erb b/app/views/polls/questions/_answers.html.erb index ee76706fc..16d3dcb01 100644 --- a/app/views/polls/questions/_answers.html.erb +++ b/app/views/polls/questions/_answers.html.erb @@ -1,23 +1,46 @@ -