Module: Hydra::RoleManagement::RolesBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- RolesController
- Defined in:
- app/controllers/concerns/hydra/role_management/roles_behavior.rb
Overview
Module defining Controller actions for creating and managing Roles
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 23 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 |
#destroy ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 43 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 |
#edit ⇒ Object
21 |
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 21 def edit; end |
#index ⇒ Object
13 |
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 13 def index; end |
#new ⇒ Object
19 |
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 19 def new; end |
#show ⇒ Object
15 16 17 |
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 15 def show redirect_to role_management.edit_role_path(@role) if can? :edit, @role end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 33 def update @role = Role.find(params[:id]) if @role.update(role_params) redirect_to role_management.edit_role_path(@role), notice: 'Role was successfully updated.' else render action: 'edit' end end |