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

Deprecate Spree::NamedType Concern #5541

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Conversation

elia
Copy link
Member

@elia elia commented Dec 6, 2023

Summary

This module was a pretend shared behavior while the inlcuding classes were not related.

Eventually we'll replace some of the default scopes with regular sorting scopes since default scopes often cause issues.

Ref: b2d4a7c

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Dec 6, 2023
This module was a pretend shared behavior while the inlcuding classes
were not related.

Eventually we'll replace some of the default scopes with regular sorting
scopes since default scopes often cause issues.

Co-Authored-By: Rainer Dema <[email protected]>
@elia elia force-pushed the elia+rainer/deprecate-named-type branch from 20535a7 to af0c7d3 Compare December 6, 2023 09:57
@@ -2,7 +2,10 @@

module Spree
class RefundReason < Spree::Base
include Spree::NamedType
scope :active, -> { where(active: true) }
default_scope -> { order(arel_table[:name].lower) }
Copy link
Member

Choose a reason for hiding this comment

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

Is there any value in having this "metaprogramming" now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, default scopes are troublemakers and eventually we'd like to migrate them to regular scopes (e.g. scope :order_by_name …) so they don't get in the way with other things (joins, batch loading, …). While checking where the default scopes were defined we thought that this "concern" was not actually shared behavior but would be better off as local model features.

I hope I got the question right, otherwise let me know 🙏

Copy link
Member Author

Choose a reason for hiding this comment

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

@kennyadsl see also b2d4a7c

@elia elia marked this pull request as ready for review December 6, 2023 17:11
@elia elia requested a review from a team as a code owner December 6, 2023 17:11
@elia elia merged commit 7afb2cd into main Dec 19, 2023
8 checks passed
@elia elia deleted the elia+rainer/deprecate-named-type branch December 19, 2023 15:34
@kennyadsl kennyadsl changed the title Deprecate Spree::NamedType Deprecate Spree::NamedType Concern Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants