Sha256: 92c0178591cf43fcdf10b586384b0efa68d0631b0e2635da9fa21947c2abafbe
Contents?: true
Size: 1.28 KB
Versions: 4
Compression:
Stored size: 1.28 KB
Contents
module CitizenBudgetModel class SectionsController < CitizenBudgetModelController before_action :authenticate_user! before_action :set_simulator before_action :set_section, only: [:show, :edit, :update, :destroy, :sort] def show end def new @section = collection.new end def edit end def create @section = collection.new(section_params) if @section.save redirect_to [@simulator, @section], notice: _('Section was created.') else render :new end end def update if @section.update(section_params) redirect_to [@simulator, @section], notice: _('Section was updated.') else render :edit end end def destroy @section.destroy redirect_to @simulator, notice: _('Section was deleted.') end def sort super(@section.questions) end private def collection @collection ||= @simulator.sections end def set_simulator @simulator = simulators.find(params[:simulator_id]) end def set_section @section = collection.find(params[:id]) end def section_params attribute_names = Section.globalize_attribute_names + [:html_class] params.require(:section).permit(*attribute_names) end end end
Version data entries
4 entries across 4 versions & 1 rubygems