Sha256: 90bab04a7fa9e85a67a640270edd425f7eec1b78aa95696a93913d1c66f766d1

Contents?: true

Size: 793 Bytes

Versions: 11

Compression:

Stored size: 793 Bytes

Contents

module Adminpanel
  class SectionsController < Adminpanel::ApplicationController
    def index
      @sections = Section.all
    end

    def edit
      @section = Section.find(params[:id])
    end

    def update
      @section = Section.find(params[:id])

      if @section.update(section_params)
        redirect_to section_path(@section), notice: 'La seccion se ha actualizado'
      else
        render 'edit'
      end
    end

    private
    def section_params
      params.require(:section).permit(
        :has_description,
        :description,
        :key,
        :page,
        :name,
        :max_files,
        :has_image,
        {
          sectionfiles_attributes: [
            :id,
            :file,
            :_destroy
          ]
        }
      )
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
adminpanel-2.6.1 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.6.0 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.5.5 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.5.4 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.5.3 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.5.2 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.5.1 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.5.0 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.4.3 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.4.2 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.4.1 app/controllers/adminpanel/sections_controller.rb