data icon indicating copy to clipboard operation
data copied to clipboard

unhelpful error in tests if dev forgets to apply polymorphic flag

Open BryanCrotaz opened this issue 3 years ago • 1 comments

Error when serializing a model: You looked up the <name> belongsTo relationship for {type: model-name...} but that relationship is a hasMany.

Happens when the hasMany end of the relationship does not specify polymorphic and the belongsTo end is polymorphic. Happens during construction of the snapshot of the polymorphic model by the looks of it.

Fix is to specify polymorphic on the hasMany, but the error message doesn't send you in that direction.

Interestingly the test only fails if it's not the first one to run, so it fails on every other test run as failed tests run first. Very confusing!

BryanCrotaz avatar Nov 21 '21 22:11 BryanCrotaz

same for me

lifeart avatar Jan 24 '22 16:01 lifeart