Skip to content

Commit d42feb0

Browse files
author
Miguel Molina
committed
Changes requested by @Serabe
1 parent dcda3a7 commit d42feb0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

generator/templates/model.tgo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ func (r *{{.Name}}) SetRelationship(field string, rel interface{}) error {
4242
return fmt.Errorf("kallax: record of type %t can't be assigned to relationship {{.Name}}", rel)
4343
}
4444
{{if .IsPtr}}if !val.Model.ID.IsEmpty() {
45-
{{end}}r.{{.Name}} = {{if or (not .IsPtr) .IsOneToManyRelationship}}*{{end}}val{{if .IsPtr}}
45+
r.{{.Name}} = val
4646
}
47-
{{end}}
47+
{{else}}r.{{.Name}} = *val{{end}}
4848
return nil
4949
{{else}}case "{{.Name}}":
5050
records, ok := rel.([]kallax.Record)

0 commit comments

Comments
 (0)