Skip to content

Commit

Permalink
Merge branch 'BugHert push origin master-fix-one-to-one-relation'
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Nov 12, 2014
2 parents b261296 + b1c2a22 commit a405f08
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scope_private.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit a405f08

Please sign in to comment.