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

[FIX] A few small tweaks for the new promotion admin #5953

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

adammathys
Copy link
Contributor

Summary

Makes a couple of small tweaks to fix a few issues with the new promotions admin:

  1. Adds the inverse_of option to the SolidusPromotions::Promotion#codes association.
    • This helps fix an issue preventing new promotions with a single code from being created. It would generate an undefined method on nil error because the new promotion code would not recognize that it was associated to an unpersisted promotion.
  2. Sets the model_class on the new Admin::PromotionCodesController.
    • Due to how our admin resource controllers are setup, we need to explicitly set the value because the default is to assume everything exists within the Spree namespace.

Checklist

adammathys and others added 2 commits November 27, 2024 15:06
This helps fix an issue when creating a new promotion with a single
code. Without the inverse_of parameter, our associated codes won't
correctly infer that they're associated to a new promotion and will
generate undefined method for nil errors.

Co-authored-by: Alistair Norman <[email protected]>
Unfortunately, our resource controller is hardcoded to look for a
`Spree::<model_name>` object, which obviously doesn't work with the new
promotion namespace.

Co-authored-by: Alistair Norman <[email protected]>
@adammathys adammathys requested a review from a team as a code owner November 27, 2024 23:23
@github-actions github-actions bot added the changelog:solidus_promotions Changes to the solidus_promotions gem label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_promotions Changes to the solidus_promotions gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants