Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activerecord-Import imports associations for invalid models #857

Open
jacob-carlborg-apoex opened this issue Nov 1, 2024 · 0 comments
Open

Comments

@jacob-carlborg-apoex
Copy link
Contributor

jacob-carlborg-apoex commented Nov 1, 2024

When importing models with associations and the main model fails to validate, Activerecord-Import will import the associations anyway. This is with the recursive: true option.

The problem is here:

import_associations(models, options.dup.merge(validate: false))

The models that failed to validate need to be filtered out from the models variable. I don't have time right now to do a PR.

jacob-carlborg-apoex added a commit to jacob-carlborg-apoex/activerecord-import that referenced this issue Nov 5, 2024
jacob-carlborg-apoex added a commit to jacob-carlborg-apoex/activerecord-import that referenced this issue Nov 5, 2024
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

No branches or pull requests

1 participant