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

Commit b8f5e3f1 by overlookmotel

Use model names not singularised table names pt1

1 parent 2bbf6397
......@@ -43,7 +43,7 @@ module.exports = (function() {
options.include = options.include || [];
options.include.push({
model: through.model,
as: Utils.singularize(through.model.tableName),
as: through.model.name,
attributes: options.joinTableAttributes,
association: {
isSingleAssociation: true,
......
......@@ -1854,7 +1854,7 @@ module.exports = (function() {
include.through = Utils._.defaults(include.through || {}, {
model: through.model,
as: Utils.singularize(through.model.tableName),
as: through.model.name,
association: {
isSingleAssociation: true
},
......
......@@ -939,9 +939,9 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
}).then(function(projects) {
expect(projects).to.have.length(1);
var project = projects[0];
expect(project.ProjectUser).to.be.defined;
expect(project.ProjectUsers).to.be.defined;
expect(project.status).not.to.exist;
expect(project.ProjectUser.status).to.equal('active');
expect(project.ProjectUsers.status).to.equal('active');
});
});
});
......@@ -1778,8 +1778,8 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
expect(project.UserProjects).to.be.defined;
expect(project.status).not.to.exist;
expect(project.UserProject.status).to.equal('active');
expect(project.UserProject.data).to.equal(42);
expect(project.UserProjects.status).to.equal('active');
expect(project.UserProjects.data).to.equal(42);
});
});
......@@ -1796,8 +1796,8 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
expect(project.UserProjects).to.be.defined;
expect(project.status).not.to.exist;
expect(project.UserProject.status).to.equal('active');
expect(project.UserProject.data).not.to.exist;
expect(project.UserProjects.status).to.equal('active');
expect(project.UserProjects.data).not.to.exist;
});
});
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!