Sha256: fa4d6ca888f139c14b8d46d2bd2746a9447c0ab3a1a6a5a69e8d624b80229d8d
Contents?: true
Size: 1.04 KB
Versions: 31
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module Decidim module Meetings module Polls class AnswersController < Decidim::Meetings::ApplicationController include Decidim::Meetings::PollsResources include FormFactory helper_method :question def create enforce_permission_to :create, :answer, question: question @form = form(AnswerForm).from_params(params, question: question, current_user: current_user) CreateAnswer.call(@form, current_user, questionnaire) do # Both :ok and :invalid render the same template, because # validation errors are displayed in the template respond_to do |format| format.js end end end private def question @question ||= questionnaire.questions.find(answer_params[:question_id]) if questionnaire end def answer_params params.require(:answer).permit(:question_id, choices: [:body, :answer_option_id]) end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems