diff --git a/app/models/account.rb b/app/models/account.rb index d397efd2..52d09ba3 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -59,18 +59,6 @@ class Account < ApplicationRecord after_create :create_careerplug_webhook - private - - def create_careerplug_webhook - return unless ENV['CAREERPLUG_WEBHOOK_SECRET'].present? - - webhook_urls.create!( - url: 'https://www.careerplug.com/api/docuseal/events', - events: %w[form.viewed form.started form.completed form.declined], - secret: { 'X-CareerPlug-Secret' => ENV.fetch('CAREERPLUG_WEBHOOK_SECRET') } - ) - end - scope :active, -> { where(archived_at: nil) } def self.find_or_create_by_external_id(external_id, name, attributes = {}) @@ -86,4 +74,16 @@ class Account < ApplicationRecord super || build_default_template_folder(name: TemplateFolder::DEFAULT_NAME, author_id: users.minimum(:id)).tap(&:save!) end + + private + + def create_careerplug_webhook + return if ENV['CAREERPLUG_WEBHOOK_SECRET'].blank? + + webhook_urls.create!( + url: 'https://www.careerplug.com/api/docuseal/events', + events: %w[form.viewed form.started form.completed form.declined], + secret: { 'X-CareerPlug-Secret' => ENV.fetch('CAREERPLUG_WEBHOOK_SECRET') } + ) + end end