Class: Arpa::RolesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Arpa::RolesController
- Defined in:
- lib/generators/arpa/templates/controllers/roles_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /roles.
-
#edit ⇒ Object
GET /roles/1/edit.
-
#index ⇒ Object
GET /roles.
-
#new ⇒ Object
GET /roles/new.
-
#remove ⇒ Object
DELETE /roles/1.
-
#show ⇒ Object
GET /roles/1.
-
#update ⇒ Object
PATCH/PUT /roles/1.
Instance Method Details
#create ⇒ Object
POST /roles
25 26 27 28 29 |
# File 'lib/generators/arpa/templates/controllers/roles_controller.rb', line 25 def create role_creator.create({ role: role_params }, success: redirect_to_index(I18n.t('flash.actions.create_role.notice')), fail: render_errors(:new)) end |
#edit ⇒ Object
GET /roles/1/edit
20 21 22 |
# File 'lib/generators/arpa/templates/controllers/roles_controller.rb', line 20 def edit all_resources end |
#index ⇒ Object
GET /roles
6 7 8 |
# File 'lib/generators/arpa/templates/controllers/roles_controller.rb', line 6 def index @roles = role_finder.all end |
#new ⇒ Object
GET /roles/new
14 15 16 17 |
# File 'lib/generators/arpa/templates/controllers/roles_controller.rb', line 14 def new @role = Arpa::Entities::Role.new all_resources end |
#remove ⇒ Object
DELETE /roles/1
39 40 41 42 43 |
# File 'lib/generators/arpa/templates/controllers/roles_controller.rb', line 39 def remove role_remover.remove({ role: @role }, success: redirect_to_index(I18n.t('flash.actions.remove_role.notice')), fail: redirect_to_index(I18n.t('flash.actions.remove_role.alert'))) end |
#show ⇒ Object
GET /roles/1
11 |
# File 'lib/generators/arpa/templates/controllers/roles_controller.rb', line 11 def show; end |
#update ⇒ Object
PATCH/PUT /roles/1
32 33 34 35 36 |
# File 'lib/generators/arpa/templates/controllers/roles_controller.rb', line 32 def update role_updater.update({ role: role_params }, success: redirect_to_index(I18n.t('flash.actions.update_role.notice')), fail: render_errors(:edit)) end |