Sha256: 77d15975985569b8c60e55992fceb090451df80cea76e21679dfba86f4fe0d2b
Contents?: true
Size: 963 Bytes
Versions: 8
Compression:
Stored size: 963 Bytes
Contents
# frozen_string_literal: true require_dependency 'c/admin_controller' module C class Admin::RolesController < AdminController load_and_authorize_resource class: C::Role def index; end def new; end def create if @role.save flash[:success] = 'Role saved.' redirect_to roles_path else render :new end end def edit; end def update if @role.update(role_params) flash[:success] = 'Role updated.' redirect_to roles_path else render :edit end end def destroy if @role.destroy flash[:success] = 'Role deleted.' else flash[:error] = 'An error occurred.' end redirect_to roles_path end def confirm_destroy; end private def role_params params.require(:role).permit(:name, :body, permissions_attributes: [:id, :permission_subject_id, :read, :new, :edit, :remove]) end end end
Version data entries
8 entries across 8 versions & 1 rubygems