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 32 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 20 def create self.hook = relation.new(hook_params) hook.save if hook.valid? flash[:notice] = _('Webhook was created') else self.hooks = relation.select(&:persisted?) flash[:alert] = hook.errors..to_sentence.html_safe end redirect_to action: :index end |
#destroy ⇒ Object
43 44 45 46 47 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 43 def destroy destroy_hook(hook) redirect_to action: :index, status: :found end |
#edit ⇒ Object
49 50 51 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 49 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
34 35 36 37 38 39 40 41 |
# File 'app/controllers/concerns/web_hooks/hook_actions.rb', line 34 def update if hook.update(hook_params) flash[:notice] = _('Webhook was updated') redirect_to action: :edit else render 'edit' end end |