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

Commit 7dd01aa0 by Sascha Gehlich

Merge branch 'bugfix/find-transaction-option' into feature/create-relation-objects

2 parents c53c2f2e b859ca44
...@@ -58,7 +58,6 @@ module.exports = (function() { ...@@ -58,7 +58,6 @@ module.exports = (function() {
obj[this.accessors.get] = function(params) { obj[this.accessors.get] = function(params) {
var id = this[self.identifier] var id = this[self.identifier]
, where = {} , where = {}
, options = Utils._.pick(params || {}, 'transaction')
where[primaryKey] = id where[primaryKey] = id
...@@ -72,7 +71,7 @@ module.exports = (function() { ...@@ -72,7 +71,7 @@ module.exports = (function() {
params = id params = id
} }
return self.target.find(params, options) return self.target.find(params)
} }
return this return this
......
...@@ -536,7 +536,7 @@ module.exports = (function() { ...@@ -536,7 +536,7 @@ module.exports = (function() {
plain: true, plain: true,
type: 'SELECT', type: 'SELECT',
hasJoin: hasJoin hasJoin: hasJoin
}, queryOptions)) }, queryOptions, { transaction: (options || {}).transaction }))
} }
DAOFactory.prototype.aggregate = function(field, aggregateFunction, options) { DAOFactory.prototype.aggregate = function(field, aggregateFunction, options) {
......
...@@ -466,6 +466,25 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -466,6 +466,25 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}) })
}) })
describe('find', function() {
it('supports the transaction option in the first parameter', function(done) {
Support.prepareTransactionTest(this.sequelize, function(sequelize) {
var User = sequelize.define('User', { username: Sequelize.STRING, foo: Sequelize.STRING })
User.sync({ force: true }).success(function() {
sequelize.transaction(function(t) {
User.create({ username: 'foo' }, { transaction: t }).success(function() {
User.find({ where: { username: 'foo' }, transaction: t }).success(function(user) {
expect(user).to.not.be.null
t.rollback().success(function() { done() })
})
})
})
})
})
})
})
describe('findOrInitialize', function() { describe('findOrInitialize', function() {
it('supports transactions', function(done) { it('supports transactions', function(done) {
Support.prepareTransactionTest(this.sequelize, function(sequelize) { Support.prepareTransactionTest(this.sequelize, function(sequelize) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!