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

Saving many-to-one with an invalid ID creates empty object #18

Open
jasperdenk opened this issue Dec 14, 2020 · 1 comment
Open

Saving many-to-one with an invalid ID creates empty object #18

jasperdenk opened this issue Dec 14, 2020 · 1 comment
Assignees

Comments

@jasperdenk
Copy link
Collaborator

When you save an object with a many-to-one relation and the ID for the many-to-one object is invalid, an empty new object is created.

For example:

Object1.save({ object2 = object2id });

if object2id is not a valid object2 ID, a new object2 object will be created in the database.

@mjhagen
Copy link
Collaborator

mjhagen commented Dec 16, 2020

I'll look into it, but I think what makes this not a straight forward fix is that I use fake IDs while working with objects before they get persisted to that database.

Work around would be to check the objects you pass into save() beforehand.

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

No branches or pull requests

2 participants