Delete all notifications instead of destroying (#12577)

* Delete all notifications instead of destroying

* Update spec to match new association
This commit is contained in:
Andy Zhao 2021-02-04 14:41:17 -05:00 committed by GitHub
parent e1b1fe3ed7
commit 82b7f6519d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -27,7 +27,7 @@ class Organization < ApplicationRecord
has_many :credits, dependent: :restrict_with_error
has_many :display_ads, dependent: :destroy
has_many :listings, dependent: :destroy
has_many :notifications, dependent: :destroy
has_many :notifications, dependent: :delete_all
has_many :organization_memberships, dependent: :delete_all
has_many :profile_pins, as: :profile, inverse_of: :profile, dependent: :destroy
has_many :sponsorships, dependent: :destroy

View file

@ -12,7 +12,7 @@ RSpec.describe Organization, type: :model do
it { is_expected.to have_many(:credits).dependent(:restrict_with_error) }
it { is_expected.to have_many(:display_ads).dependent(:destroy) }
it { is_expected.to have_many(:listings).dependent(:destroy) }
it { is_expected.to have_many(:notifications).dependent(:destroy) }
it { is_expected.to have_many(:notifications).dependent(:delete_all) }
it { is_expected.to have_many(:organization_memberships).dependent(:delete_all) }
it { is_expected.to have_many(:profile_pins).dependent(:destroy) }
it { is_expected.to have_many(:sponsorships).dependent(:destroy) }