Class: RbacRls::RolesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RbacRls::RolesController
- Defined in:
- app/controllers/rbac_rls/roles_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /roles.
-
#destroy ⇒ Object
DELETE /roles/1.
-
#edit ⇒ Object
GET /roles/1/edit.
-
#index ⇒ Object
GET /roles.
-
#new ⇒ Object
GET /roles/new.
-
#show ⇒ Object
GET /roles/1.
-
#update ⇒ Object
PATCH/PUT /roles/1.
Instance Method Details
#create ⇒ Object
POST /roles
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/rbac_rls/roles_controller.rb', line 24 def create @role = Role.new(role_params) if @role.save redirect_to @role, notice: "Role was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /roles/1
44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/rbac_rls/roles_controller.rb', line 44 def destroy notice_msg = "Role was successfully destroyed." @role.destroy if @role.errors.size > 0 notice_msg = @role.errors&.&.first&.last&.last end redirect_to roles_url, notice: notice_msg end |
#edit ⇒ Object
GET /roles/1/edit
20 21 |
# File 'app/controllers/rbac_rls/roles_controller.rb', line 20 def edit end |
#index ⇒ Object
GET /roles
6 7 8 |
# File 'app/controllers/rbac_rls/roles_controller.rb', line 6 def index @roles = Role.all end |
#new ⇒ Object
GET /roles/new
15 16 17 |
# File 'app/controllers/rbac_rls/roles_controller.rb', line 15 def new @role = RbacRls::Role.new end |
#show ⇒ Object
GET /roles/1
11 12 |
# File 'app/controllers/rbac_rls/roles_controller.rb', line 11 def show end |
#update ⇒ Object
PATCH/PUT /roles/1
35 36 37 38 39 40 41 |
# File 'app/controllers/rbac_rls/roles_controller.rb', line 35 def update if @role.update(role_params) redirect_to @role, notice: "Role was successfully updated." else render :edit, status: :unprocessable_entity end end |