1:many fix
This commit is contained in:
parent
b705b0ecbb
commit
44e41c228d
5
scope.go
5
scope.go
@ -1084,6 +1084,11 @@ func (scope *Scope) related(value interface{}, foreignKeys ...string) *Scope {
|
|||||||
if relationship.PolymorphicType != "" {
|
if relationship.PolymorphicType != "" {
|
||||||
tx = tx.Where(fmt.Sprintf("%v = ?", scope.Quote(relationship.PolymorphicDBName)), relationship.PolymorphicValue)
|
tx = tx.Where(fmt.Sprintf("%v = ?", scope.Quote(relationship.PolymorphicDBName)), relationship.PolymorphicValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, condition := range relationship.ArbitraryJoinConditions {
|
||||||
|
tx = tx.Where(condition)
|
||||||
|
}
|
||||||
|
|
||||||
scope.Err(tx.Find(value).Error)
|
scope.Err(tx.Find(value).Error)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user