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

Commit bfefdae2 by Mick Hansen

fix(include): values from includes loaded with separate now set with raw: true, closes #4740

1 parent 44c7049d
# NEXT # NEXT
- [FIXED] timestamp columns are no longer undefined for associations loaded with `separate`. [#4740](https://github.com/sequelize/sequelize/issues/4740)
- [FIXED] Mark unscoped model as `.scoped`, to prevent injection of default scope on includes [#4663](https://github.com/sequelize/sequelize/issues/4663) - [FIXED] Mark unscoped model as `.scoped`, to prevent injection of default scope on includes [#4663](https://github.com/sequelize/sequelize/issues/4663)
- [ADDED] `.previous` now returns and object of previous values when called without `key`. This brings the API in line with `.changed` - [ADDED] `.previous` now returns and object of previous values when called without `key`. This brings the API in line with `.changed`
......
...@@ -1431,7 +1431,10 @@ Model.$findSeparate = function(results, options) { ...@@ -1431,7 +1431,10 @@ Model.$findSeparate = function(results, options) {
results.forEach(function (result) { results.forEach(function (result) {
result.set( result.set(
include.association.as, include.association.as,
map[result.get(include.association.source.primaryKeyAttribute)] map[result.get(include.association.source.primaryKeyAttribute)],
{
raw: true
}
); );
}); });
}); });
......
...@@ -56,6 +56,10 @@ if (current.dialect.supports.groupedLimit) { ...@@ -56,6 +56,10 @@ if (current.dialect.supports.groupedLimit) {
expect(users[0].get('tasks').length).to.equal(3); expect(users[0].get('tasks').length).to.equal(3);
expect(users[1].get('tasks')).to.be.ok; expect(users[1].get('tasks')).to.be.ok;
expect(users[1].get('tasks').length).to.equal(1); expect(users[1].get('tasks').length).to.equal(1);
expect(users[0].get('tasks')[0].createdAt).to.be.ok;
expect(users[0].get('tasks')[0].updatedAt).to.be.ok;
expect(sqlSpy).to.have.been.calledTwice; expect(sqlSpy).to.have.been.calledTwice;
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!