Skip to content

Conversation

Paul-Bob
Copy link
Contributor

Description

Fixes #4028

apply_attach_scope on the Avo::SearchController was assuming a nested association chain like

User -> Create new Workspace -> Search for an Organization to attach to the workspace

In the above scenario, when creating a new workspace to hydrate the attach scope with a parent, the code was assuming that the workspace and user association was always a belongs to or has one. When the association is a collection, it breaks. This PR changes it by checking the parent and grandparent association type before assigning the grandparent to the parent record.


Thanks for the detailed issue and reproduction repository @icaroryan, that made my intervention in finding and fixing the bug really productive!

Copy link

linear bot commented Aug 13, 2025

@Paul-Bob Paul-Bob self-assigned this Aug 13, 2025
@github-actions github-actions bot added the Fix label Aug 13, 2025
@Paul-Bob Paul-Bob merged commit 4a156f3 into main Aug 13, 2025
20 of 24 checks passed
@Paul-Bob Paul-Bob deleted the avo-737/fix/attach_scope branch August 13, 2025 10:08
Copy link
Contributor

This PR has been merged into main. The functionality will be available in the next release.

Please check the release guide for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

attach_scope: belongs_to search fails in “new” via has_many
1 participant