fix: Ottieni correttamente la relationship

This commit is contained in:
Maicol Battistini 2022-01-29 11:13:26 +01:00
parent 94e85ad8b6
commit b82dd13983
No known key found for this signature in database
GPG Key ID: 4FDB0F87CDB1D34A
1 changed files with 2 additions and 1 deletions

View File

@ -389,7 +389,8 @@ export class RecordsPage extends Page {
const relations: Record<string, IModel> = {};
for (const [field, value] of Object.entries(data.all())) {
if ((model as unknown as typeof Model).relationships.includes(field)) {
const proto = (Object.getPrototypeOf(model) as Model).constructor as typeof Model;
if (proto.relationships.includes(field)) {
relations[field] = await this.getRelation(model, field, false, Number(value)) as IModel;
}