Sha256: 4f0dc6fb7f645bb027a5de92dba63b2197138e2bd0008748b4fc0d4779a583ef

Contents?: true

Size: 929 Bytes

Versions: 10

Compression:

Stored size: 929 Bytes

Contents

module Gaku
  class Admin::RolesController < Admin::BaseController

    #load_and_authorize_resource class: Role

    respond_to :js,   only: %i( new create edit update destroy )
    respond_to :html, only: :index

    before_action :set_role, only: %i( edit update destroy )

    def index
      @roles = Role.all
      @count = Role.count
      respond_with @roles
    end

    def new
      @role = Role.new
      respond_with @role
    end

    def create
      @role = Role.new(role_params)
      @role.save
      @count = Role.count
      respond_with @role
    end

    def edit
    end

    def update
      @role.update(role_params)
      respond_with @role
    end

    def destroy
      @role.destroy
      @count = Role.count
      respond_with @role
    end

    private

    def set_role
      @role = Role.find(params[:id])
    end

    def role_params
      params.require(:role).permit(:name)
    end

  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
gaku-0.1.1 admin/app/controllers/gaku/admin/roles_controller.rb
gaku_admin-0.1.1 app/controllers/gaku/admin/roles_controller.rb
gaku-0.1.0 admin/app/controllers/gaku/admin/roles_controller.rb
gaku_admin-0.1.0 app/controllers/gaku/admin/roles_controller.rb
gaku_core-0.0.3 app/controllers/gaku/admin/roles_controller.rb
gaku-0.0.3 core/app/controllers/gaku/admin/roles_controller.rb
gaku-0.0.2 core/app/controllers/gaku/admin/roles_controller.rb
gaku_core-0.0.2 app/controllers/gaku/admin/roles_controller.rb
gaku-0.0.1 core/app/controllers/gaku/admin/roles_controller.rb
gaku_core-0.0.1 app/controllers/gaku/admin/roles_controller.rb