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

Commit 7fb45bf5 by Mick Hansen

consistency

1 parent a0512041
......@@ -137,14 +137,14 @@ module.exports = (function() {
, self = this
, primaryKeyDeleted = false
this.identifier = this.options.foreignKey || Utils._.underscoredIf(Utils.singularize(this.source.name, this.source.options.language) + "Id", this.source.options.underscored)
this.identifier = this.options.foreignKey || Utils._.camelizeIf(Utils.singularize(this.source.name, this.source.options.language) + "_id", !this.source.options.underscored)
// is there already a single sided association between the source and the target?
// or is the association on the model itself?
if ((this.isSelfAssociation && Object(this.through) === this.through) || doubleLinked) {
// remove the obsolete association identifier from the source
if (this.isSelfAssociation) {
this.foreignIdentifier = Utils._.underscoredIf((this.options.as || this.target.name) + 'Id', this.target.options.underscored)
this.foreignIdentifier = Utils._.camelizeIf((this.options.as || this.target.name) + '_id', !this.target.options.underscored)
} else {
this.foreignIdentifier = this.targetAssociation.identifier
this.targetAssociation.foreignIdentifier = this.identifier
......
......@@ -921,7 +921,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
this.User.hasMany(this.Task, { through: this.UserTasks })
this.Task.hasMany(this.User, { through: this.UserTasks })
expect(Object.keys(self.UserTasks.primaryKeys)).to.deep.equal(['taskId', 'userId'])
expect(Object.keys(self.UserTasks.primaryKeys)).to.deep.equal(['TaskId', 'UserId'])
})
it('keeps the primary key if it was added by the user', function () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!