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

Commit 23d58fe6 by Chase Geigle

Fix multiple assocations with same table for belongsTo and hasOne.

If specifying an "as" in the options, use that as the associationAccessor
instead of the table name to prevent being overridden.
1 parent b494f985
......@@ -13,7 +13,7 @@ module.exports = (function() {
this.associationAccessor = this.isSelfAssociation
? Utils.combineTableNames(this.target.tableName, this.options.as || this.target.tableName)
: this.target.tableName
: this.options.as || this.target.tableName
}
// the id is in the source table
......
......@@ -13,7 +13,7 @@ module.exports = (function() {
this.associationAccessor = this.isSelfAssociation
? Utils.combineTableNames(this.target.tableName, this.options.as || this.target.tableName)
: this.target.tableName
: this.options.as || this.target.tableName
this.accessors = {
get: Utils._.camelize('get_' + (this.options.as || Utils.singularize(this.target.tableName))),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!