forked from mirror/gorm
Merge branch 'BugHert push origin master-fix-one-to-one-relation'
This commit is contained in:
commit
a405f08f3a
|
@ -475,7 +475,8 @@ func (scope *Scope) related(value interface{}, foreignKeys ...string) *Scope {
|
|||
|
||||
// has one
|
||||
if foreignValue, err := scope.FieldValueByName(foreignKey); err == nil {
|
||||
toScope.inlineCondition(foreignValue).callCallbacks(scope.db.parent.callback.queries)
|
||||
sql := fmt.Sprintf("%v = ?", scope.Quote(toScope.PrimaryKey()))
|
||||
toScope.inlineCondition(sql, foreignValue).callCallbacks(scope.db.parent.callback.queries)
|
||||
return scope
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue