From 0a96b31f7fd490857afd214fff58679a774d30dc Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Sat, 24 Jan 2026 01:09:24 -0800 Subject: [PATCH] fix(integrations): set hook_type only on create --- app/models/integrations/hook.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/integrations/hook.rb b/app/models/integrations/hook.rb index 90d50278c..8805000ef 100644 --- a/app/models/integrations/hook.rb +++ b/app/models/integrations/hook.rb @@ -18,7 +18,7 @@ class Integrations::Hook < ApplicationRecord include Reauthorizable attr_readonly :app_id, :account_id, :inbox_id, :hook_type - before_validation :ensure_hook_type + before_validation :ensure_hook_type, on: :create after_create :trigger_setup_if_crm # TODO: Remove guard once encryption keys become mandatory (target 3-4 releases out). @@ -87,9 +87,7 @@ class Integrations::Hook < ApplicationRecord def ensure_hook_type return if app.blank? - return unless new_record? - # hook_type is readonly; only set it on create to avoid update-time errors in Rails 7.1+ self.hook_type = app.params[:hook_type] end