pop icon indicating copy to clipboard operation
pop copied to clipboard

Eager Save appears to not persist children in one-to-many and many-to-many relations

Open fasmat opened this issue 4 years ago • 2 comments

Description

If I try to Save instead of Creating a model in my DB any relations I define will not be persisted. This is probably related to issue #136

Steps to Reproduce the Problem

Within a transaction call tx.Eager().Save(model) or tx.Eager().ValidateAndSave(model)

Expected Behavior

The model is persisted with its children.

Actual Behavior

Only the model is persisted, the children are not

Info

I'm using Pop v5.0.11 on Linux with a Postgres db.

fasmat avatar Apr 18 '20 21:04 fasmat

Do you think it's related to https://github.com/gobuffalo/buffalo/issues/1980? In this case even the model isn't being persisted.

wedneyyuri avatar Apr 23 '20 00:04 wedneyyuri

Do you think it's related to gobuffalo/buffalo#1980? In this case even the model isn't being persisted.

No the error I'm referring to is on the DB layer, not on the API layer. The model is persisted when I execute Save, but any relationships to it are not.

fasmat avatar Apr 23 '20 16:04 fasmat