diff --git a/app/controllers/webhook_settings_controller.rb b/app/controllers/webhook_settings_controller.rb index 2382dad3..1748ef4d 100644 --- a/app/controllers/webhook_settings_controller.rb +++ b/app/controllers/webhook_settings_controller.rb @@ -7,7 +7,9 @@ class WebhookSettingsController < ApplicationController def show; end def create - @encrypted_config.update!(encrypted_config_params) + @encrypted_config.assign_attributes(encrypted_config_params) + + @encrypted_config.value.present? ? @encrypted_config.save! : @encrypted_config.delete redirect_back(fallback_location: settings_webhooks_path, notice: 'Webhook URL has been saved.') end diff --git a/app/views/webhook_settings/show.html.erb b/app/views/webhook_settings/show.html.erb index 1e676cc6..ca88c87f 100644 --- a/app/views/webhook_settings/show.html.erb +++ b/app/views/webhook_settings/show.html.erb @@ -7,7 +7,7 @@ <%= form_for @encrypted_config, url: settings_webhooks_path, method: :post, html: { autocomplete: 'off' } do |f| %> <%= f.label :value, 'Webhook URL', class: 'text-sm font-semibold' %>