class Ecs::EcTrainingObjectivesController < Ecs::BaseController before_action :check_major_manager_permission!, only: [:create] def show @training_objective = current_year.ec_training_objective respond_to do |format| format.json format.xlsx do filename = "#{@training_objective.ec_year.year}届培养目标_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx" render xlsx: 'show', filename: filename end end end def create @training_objective = Ecs::CreateTrainingObjectiveService.call(current_year, create_params) render 'show' end private def create_params params.permit(:content, training_subitems: [:id, :content]) end end