From 73ddb1fe5790d131abece8b3ebe250d6c6ad9e0f Mon Sep 17 00:00:00 2001 From: Stephen Afam-Osemene Date: Tue, 25 Apr 2023 09:57:57 +0100 Subject: [PATCH] Check all memebers when loading relationships --- gen/templates/models/10_rel_load.go.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gen/templates/models/10_rel_load.go.tpl b/gen/templates/models/10_rel_load.go.tpl index 7433f1d6..6989760f 100644 --- a/gen/templates/models/10_rel_load.go.tpl +++ b/gen/templates/models/10_rel_load.go.tpl @@ -218,8 +218,8 @@ func (os {{$tAlias.UpSingular}}Slice) Load{{$tAlias.UpSingular}}{{$relAlias}}(ct } {{- end}} - for _, rel := range {{$fAlias.DownPlural}} { - for _, o := range os { + for _, o := range os { + for _, rel := range {{$fAlias.DownPlural}} { {{range $index, $local := $side.FromColumns -}} {{- $foreign := index $side.ToColumns $index -}} {{- $fromColGet := columnGetter $.Tables $side.From $fromAlias $local -}} @@ -287,8 +287,8 @@ func (os {{$tAlias.UpSingular}}Slice) Load{{$tAlias.UpSingular}}{{$relAlias}}(ct } {{- end}} - for _, rel := range {{$fAlias.DownPlural}} { - for _, o := range os { + for _, o := range os { + for _, rel := range {{$fAlias.DownPlural}} { {{range $index, $local := $firstSide.FromColumns -}} {{- $fromCol := index $firstFrom.Columns $local -}} if o.{{$fromCol}} != rel.Related{{$fromCol}} {