Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy pages urls and folded pages if page gets destroyed #2678

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/alchemy/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ class Page < BaseRecord

has_one :site, through: :language
has_many :site_languages, through: :site, source: :languages
has_many :folded_pages
has_many :legacy_urls, class_name: "Alchemy::LegacyPageUrl"
has_many :folded_pages, dependent: :destroy
has_many :legacy_urls, class_name: "Alchemy::LegacyPageUrl", dependent: :destroy
has_many :nodes, class_name: "Alchemy::Node", inverse_of: :page
has_many :versions, class_name: "Alchemy::PageVersion", inverse_of: :page, dependent: :destroy
has_one :draft_version, -> { drafts }, class_name: "Alchemy::PageVersion"
Expand Down
2 changes: 2 additions & 0 deletions spec/models/alchemy/page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

module Alchemy
describe Page do
it { is_expected.to have_many(:folded_pages).dependent(:destroy) }
it { is_expected.to have_many(:legacy_urls).dependent(:destroy) }
it { is_expected.to have_many(:versions) }
it { is_expected.to have_one(:draft_version) }
it { is_expected.to have_one(:public_version) }
Expand Down
Loading