Skip to content

Commit

Permalink
misc: Delete webhooks directly from the database when deleting webhoo…
Browse files Browse the repository at this point in the history
…k endpoint
  • Loading branch information
rsempe committed Dec 10, 2024
1 parent d8a3d50 commit 8c1e97b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/webhook_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class WebhookEndpoint < ApplicationRecord
].freeze

belongs_to :organization
has_many :webhooks, dependent: :destroy
has_many :webhooks, dependent: :delete_all

validates :webhook_url, presence: true, url: true
validates :webhook_url, uniqueness: {scope: :organization_id}
Expand Down
2 changes: 1 addition & 1 deletion spec/models/webhook_endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe WebhookEndpoint, type: :model do
it { is_expected.to belong_to(:organization) }
it { is_expected.to have_many(:webhooks).dependent(:destroy) }
it { is_expected.to have_many(:webhooks).dependent(:delete_all) }

it { is_expected.to validate_presence_of(:webhook_url) }

Expand Down

0 comments on commit 8c1e97b

Please sign in to comment.