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}} {