Sha256: 09d4701ad7a2f0c8cff3a5699493fd3dc3c191ca1e8da086524d9db2dd6a27d8
Contents?: true
Size: 1.01 KB
Versions: 6
Compression:
Stored size: 1.01 KB
Contents
module HelenaAdministration class ImportSurveysController < ApplicationController before_action :add_breadcrumbs def new add_breadcrumb t('.import') @import_survey_form = ImportSurveyForm.new end # rubocop:disable Metrics/MethodLength def create @import_survey_form = ImportSurveyForm.new import_survey_form_params if @import_survey_form.valid? begin Helena::SurveyImporter.new @import_survey_form.script flash[:success] = t('shared.actions.created') redirect_to surveys_path rescue StandardError => e @error = e render 'new' end else flash.now[:danger] = t('shared.actions.error') render 'new' end end # rubocop:enable Metrics/MethodLength private def import_survey_form_params params.require(:import_survey_form).permit(:script) end def add_breadcrumbs add_breadcrumb t('shared.navigation.dashboard'), dashboard_index_path end end end
Version data entries
6 entries across 6 versions & 1 rubygems