Skip to content

Partial ActiveBehaviour fix for junction tables#3027

Open
SpawnCycle wants to merge 5 commits intoSeaQL:masterfrom
SpawnCycle:master
Open

Partial ActiveBehaviour fix for junction tables#3027
SpawnCycle wants to merge 5 commits intoSeaQL:masterfrom
SpawnCycle:master

Conversation

@SpawnCycle
Copy link
Copy Markdown

PR Info

Partially fixes the odd behavior with junction tables when using ActiveModelEx
Couldn't figure out how to make after_save work

Bug Fixes

  • ActiveModelBehavior is now triggered for the junction table when adding a via model

Changes

  • Adds a Send constraint in the establish links function
  • Adds before_save function call on the active model
  • Adds before/after_delete function call on the active model

@SpawnCycle SpawnCycle requested a review from Huliiiiii March 30, 2026 17:37
@SpawnCycle
Copy link
Copy Markdown
Author

While exploring the repo I saw near-identical code in sea-orm-sync, should I add the changes to it too?

@Huliiiiii
Copy link
Copy Markdown
Member

It has been fixed on master. You can just rebase.

@SpawnCycle
Copy link
Copy Markdown
Author

Will do, but what about establish_links in sea-orm-sync?

@Huliiiiii
Copy link
Copy Markdown
Member

You can run build-tools/make-sync.sh to sync changes.

if the db doesn't support returning there is no models to run after_save
with
@SpawnCycle
Copy link
Copy Markdown
Author

Mysql and mariadb don't support returning syntax, so as it is currently the after_save won't run on them

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.

ActiveModelEx odd ActiveModelBehavior with a junction table

2 participants