Sha256: 25d3ebebd4c8719334930d3824a12cccc78008de1b573314a8cce10f25d06ea4
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
# frozen_string_literal: true module Hydra module RoleManagement # Module defining Controller actions for creating and managing Roles module RolesBehavior extend ActiveSupport::Concern included do load_and_authorize_resource end def index; end def show redirect_to role_management.edit_role_path(@role) if can? :edit, @role end def new; end def edit; end def create @role = Role.new(role_params) if @role.save redirect_to role_management.edit_role_path(@role), notice: 'Role was successfully created.' else render action: 'new' end end def update @role = Role.find(params[:id]) if @role.update_attributes(role_params) redirect_to role_management.edit_role_path(@role), notice: 'Role was successfully updated.' else render action: 'edit' end end def destroy if @role.destroy redirect_to role_management.roles_path, notice: 'Role was successfully deleted.' else redirect_to role_management.roles_path end end private def role_params if !ActionController.const_defined? :StrongParameters params[:role] else params.require(:role).permit(:name) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hydra-role-management-1.0.3 | app/controllers/concerns/hydra/role_management/roles_behavior.rb |