不要怂,就是干,撸起袖子干!

Commit a745be35 by Scott Dial

Computer foreignKey for belongsTo() from the "as" option.

If "foreignKey" is not provided, but "as" is provided, then compute the
"foreignKey" from "as". This behavior matches the behavior of hasOne().
1 parent ad9561db
Showing with 1 additions and 1 deletions
......@@ -14,7 +14,7 @@ module.exports = (function() {
this.as = this.options.as
if (this.isSelfAssociation && !this.options.foreignKey && !!this.as) {
this.options.foreignKey = Utils._.underscoredIf(Utils.singularize(this.source.tableName, this.source.options.language) + "Id", this.source.options.underscored)
this.options.foreignKey = Utils._.underscoredIf(Utils.singularize(this.as, this.source.options.language) + "Id", this.source.options.underscored)
}
if (this.as) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!