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

Refactoring: Reduce usages of sti_name to minimum #9746

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Conversation

minhngocd
Copy link
Contributor

@minhngocd minhngocd commented Dec 17, 2024

sti_names methods don't seem to be used anywhere and can be removed.

within Edition::Identifiable:

  • When edition is saved, the edition type should be propogated to the document type. Additionally the document_type on an Edition is being used in multiple places so is not easy to unpick. The published as class method is used to fetch document by slug based on the type of the subclass. So unfortunately we still need to use sti_name for this.
  • The test however has 1 duplicate unecessary test, as we not only support News and Speeches sharing same slug, but all other document types too, which already has another test above covering that.

https://trello.com/c/EewW5W4A/3264-delete-selfstinames-methods

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

sti_names methods don't seem to be used anywhere and can be removed.

within Edition::Identifiable:

* When edition is saved, the edition type should be propogated to the document type. Additionally the document_type on an Edition is being used in multiple places so is not easy to unpick. The published as class method is used to fetch document by slug based on the type of the subclass. So unfortunately we still need to use sti_name for this.
* The test however has 1 duplicate unecessary test, as we not only support News and Speeches sharing same slug, but all other document types too, which already has another test above covering that.
Copy link
Contributor

@ryanb-gds ryanb-gds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹

@minhngocd minhngocd merged commit a9e0be4 into main Dec 17, 2024
19 checks passed
@minhngocd minhngocd deleted the remove_sti_name branch December 17, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants