1:many fix

This commit is contained in:
Matt Schiros 2019-01-18 14:08:48 -08:00
parent b705b0ecbb
commit 44e41c228d

View File

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