Skip to content

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

Merged
tvdeyen merged 2 commits intosolidusio:mainfrom
SuperGoodSoft:fix/new-promotions-admin
Dec 3, 2024
Merged

[FIX] A few small tweaks for the new promotion admin#5953
tvdeyen merged 2 commits intosolidusio:mainfrom
SuperGoodSoft:fix/new-promotions-admin

Conversation

@adammathys
Copy link
Copy Markdown
Member

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 <alistair@super.gd>
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 <alistair@super.gd>
@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
@tvdeyen tvdeyen merged commit fb99b20 into solidusio:main Dec 3, 2024
@tvdeyen tvdeyen added the backport-v4.4 Backport this pull-request to v4.4 label Dec 3, 2024
@tvdeyen
Copy link
Copy Markdown
Member

tvdeyen commented Dec 6, 2024

Backport after #6016

@tvdeyen tvdeyen added backport-v4.4 Backport this pull-request to v4.4 and removed backport-v4.4 Backport this pull-request to v4.4 labels Dec 6, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 6, 2024

💚 All backports created successfully

Status Branch Result
v4.4

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v4.4 Backport this pull-request to v4.4 changelog:solidus_promotions Changes to the solidus_promotions gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants