Skip to content

Conversation

@mamhoff
Copy link
Contributor

@mamhoff mamhoff commented May 30, 2025

Summary

This makes the user address book a little more reliable by adding a foreign key constraint between addresses and address book entries, and making sure that address book entries have both an address and a user.

I think the optional: true made it in here when the default changed in Rails for belongs_to associations, but these were never optional.

Extracted from #6240

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.

mamhoff added 4 commits May 30, 2025 12:25
This is to satisfy Rubocop, but it's also just good behavior. If a user
record is destroyed, we should also destroy their address book.

For the default addresses, we don't add cascading deleted, because these
are also present in the `has_many :user_addresses`.
Join records are absolutely useless if either of their "arms" are
missing. Make them mandatory.
I'm only adding a foreign key constraint between user_addresses and
addresses, not for users, because that should be the responsibility of
the user class, so we could i.e. do it in solidus_auth_devise.
@mamhoff mamhoff requested a review from a team as a code owner May 30, 2025 10:33
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label May 30, 2025
@codecov
Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.83%. Comparing base (f0a7456) to head (97df766).
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6265   +/-   ##
=======================================
  Coverage   88.82%   88.83%           
=======================================
  Files         850      850           
  Lines       18334    18336    +2     
=======================================
+ Hits        16286    16288    +2     
  Misses       2048     2048           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Very nice!

@tvdeyen tvdeyen added this to the 4.6 milestone May 30, 2025
@tvdeyen tvdeyen merged commit 997620e into solidusio:main May 30, 2025
25 checks passed
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

Development

Successfully merging this pull request may close these issues.

2 participants