The routes for poll questions were accidentally deleted in commit5bb831e959when deleting the `:show` action, and restored in commit9871503c5e. However, the deleted code was: ``` resources :questions, only: [:show], controller: 'polls/questions' (...) ``` While the restored code was: ``` resources :questions, controller: 'polls/questions' (...) ``` Meaning we forgot to add the `only: []` option when restoring the routes. We also forgot to remove the `before_action` code when deleting the `:show` action, so we're removing it now.
19 lines
470 B
Ruby
19 lines
470 B
Ruby
class Polls::QuestionsController < ApplicationController
|
|
load_and_authorize_resource :poll
|
|
load_and_authorize_resource :question, class: "Poll::Question"
|
|
|
|
def answer
|
|
answer = @question.find_or_initialize_user_answer(current_user, params[:answer])
|
|
answer.save_and_record_voter_participation
|
|
|
|
respond_to do |format|
|
|
format.html do
|
|
redirect_to request.referer
|
|
end
|
|
format.js do
|
|
render :options
|
|
end
|
|
end
|
|
end
|
|
end
|