Skip to content

Refactor#3134

Merged
tyt2y3 merged 4 commits into
masterfrom
active-model-ex-refactor-2
Jul 14, 2026
Merged

Refactor#3134
tyt2y3 merged 4 commits into
masterfrom
active-model-ex-refactor-2

Conversation

@Huliiiiii

Copy link
Copy Markdown
Member

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61f92bcb4a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 458 to 459
pub fn #clear_method(mut self) -> Self {
#clear_parent_keys
self.#field_ident = sea_orm::ActiveBelongsTo::Set(None);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore FK clearing in optional belongs-to clearers

When an optional belongs-to relation is cleared, the generated clear_* method now only marks the relation as ActiveBelongsTo::Set(None) and no longer sets the nullable from column(s) to Set(None). The generated .update()/.save() path later compensates for this, but callers that convert or inspect the ActiveModelEx before using that path—e.g. ActiveModel::from(model_ex.clear_bakery()).update(db) or try_into_model()—will keep the old/NotSet FK while the relation says it is cleared, so the direct ActiveModel update will not detach the parent.

Useful? React with 👍 / 👎.

Update test fixtures

Make key clearing strict and atomic
@Huliiiiii
Huliiiiii force-pushed the active-model-ex-refactor-2 branch from 61f92bc to 4bcbebd Compare July 14, 2026 11:39
Huliiiiii and others added 3 commits July 14, 2026 19:39
…sertions

The removed PartialEq<Option<..>> impls meant `assert_eq!(rel, None)` on a
BelongsTo<Option<Entity>> read field no longer compiles. Add an explicit
`is_unloaded_or_not_found()` (true for Unloaded or Loaded(None), matching the old
`== None` semantics) and use it in the entity-loader / active-model-ex tests.
@tyt2y3
tyt2y3 merged commit 921f38f into master Jul 14, 2026
39 checks passed
@tyt2y3
tyt2y3 deleted the active-model-ex-refactor-2 branch July 14, 2026 21:33
@Huliiiiii
Huliiiiii restored the active-model-ex-refactor-2 branch July 14, 2026 23:42
@Huliiiiii
Huliiiiii deleted the active-model-ex-refactor-2 branch July 14, 2026 23:42
@github-actions

Copy link
Copy Markdown

🎉 Released In 2.0.0-rc.43 🎉

Huge thanks for the contribution!
This feature has now been released, so it's a great time to upgrade.
Show some love with a ⭐ on our repo, every star counts!

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