Merge branch 'BugHert push origin master-fix-one-to-one-relation'

This commit is contained in:
Jinzhu 2014-11-12 10:25:43 +08:00
commit a405f08f3a
1 changed files with 2 additions and 1 deletions

View File

@ -475,7 +475,8 @@ func (scope *Scope) related(value interface{}, foreignKeys ...string) *Scope {
// has one // has one
if foreignValue, err := scope.FieldValueByName(foreignKey); err == nil { 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 return scope
} }
} }