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

Commit 7d0dbfef by Sascha Depold

require underscore.string

1 parent 819fe626
...@@ -10,13 +10,11 @@ var BelongsTo = module.exports = function(srcModel, targetModel, options) { ...@@ -10,13 +10,11 @@ var BelongsTo = module.exports = function(srcModel, targetModel, options) {
// the id is in the source table // the id is in the source table
BelongsTo.prototype.injectAttributes = function() { BelongsTo.prototype.injectAttributes = function() {
var newAttributes = {} var newAttributes = {}
this.identifier = this.target.identifierName this.identifier = this.target.identifierName
console.log(this.identifier)
newAttributes[this.identifier] = { type: DataTypes.INTEGER } newAttributes[this.identifier] = { type: DataTypes.INTEGER }
console.log(newAttributes)
Utils._.extend(this.source.attributes, Utils.simplifyAttributes(newAttributes)) Utils._.extend(this.source.attributes, Utils.simplifyAttributes(newAttributes))
console.log('ok')
console.log(this.source)
return this return this
} }
......
...@@ -17,7 +17,6 @@ module.exports = { ...@@ -17,7 +17,6 @@ module.exports = {
var Task = sequelize.define('Task' + parseInt(Math.random() * 99999999), { title: Sequelize.STRING }, {underscored: true}) var Task = sequelize.define('Task' + parseInt(Math.random() * 99999999), { title: Sequelize.STRING }, {underscored: true})
Task.belongsTo('user', User) Task.belongsTo('user', User)
console.log(Task.attributes)
assert.eql(Task.attributes.user_id, "INT") assert.eql(Task.attributes.user_id, "INT")
}, },
'it should define getter and setter': function() { 'it should define getter and setter': function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!