Module: WebHooks::HookActions
- Extended by:
- ActiveSupport::Concern
- Includes:
- HookExecutionNotice
- Included in:
- Admin::HooksController, Projects::HooksController
- Defined in:
- app/controllers/concerns/web_hooks/hook_actions.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 20 def create result = WebHooks::CreateService.new(current_user).execute(hook_params, relation) if result.success? flash[:notice] = _('Webhook was created') else self.hooks = relation.select(&:persisted?) flash[:alert] = result. end redirect_to action: :index end |
#destroy ⇒ Object
42 43 44 45 46 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 42 def destroy destroy_hook(hook) redirect_to action: :index, status: :found end |
#edit ⇒ Object
48 49 50 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 48 def edit redirect_to(action: :index) unless hook end |
#index ⇒ Object
15 16 17 18 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 15 def index self.hooks = relation.select(&:persisted?) self.hook = relation.new end |
#update ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 33 def update if hook.update(hook_params) flash[:notice] = _('Webhook was updated') redirect_to action: :edit else render 'edit' end end |