Sha256: 6f3302c9989211c9643562ee5057b917760ce9eaa7bafdf6976954f852a8e07b

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

module Adminpanel
  class SectionsController < Adminpanel::ApplicationController
    # authorize_resource
    authorize_resource
    # def new
    #   @section = Section.new
    #   authorize! :create, @section
    # end

    def edit
      @section = Section.find(params[:id])
      respond_to do |format|
        format.html
        format.json {render :json => {:section => @section }}
      end
    end

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

      if @section.update_attributes(params[:section])
        redirect_to section_path(@section), :notice => 'La seccion se ha actualizado'
      else
        render 'edit'
      end
    end

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

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

    #   redirect_to sections_path
    # end

    def index
      @sections = Section.all
    end

    private
    def section_params
      params.require(:section).permit(
      :description,
      :has_image,
      :key,
      :page,
      :name,
      :has_description,
      :images_attributes => [:id, :file]
      )

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adminpanel-2.1.7 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.1.6 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.1.5 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.1.3 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.1.2 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.1.1 app/controllers/adminpanel/sections_controller.rb
adminpanel-2.1.0 app/controllers/adminpanel/sections_controller.rb