diff --git a/chainable_api.go b/chainable_api.go index 58b9336f..5415f5bd 100644 --- a/chainable_api.go +++ b/chainable_api.go @@ -240,11 +240,10 @@ func (db *DB) Offset(offset int) (tx *DB) { // } // // db.Scopes(AmountGreaterThan1000, OrderStatus([]string{"paid", "shipped"})).Find(&orders) -func (db *DB) Scopes(funcs ...func(*DB) *DB) *DB { - for _, f := range funcs { - db = f(db) - } - return db +func (db *DB) Scopes(funcs ...func(*DB) *DB) (tx *DB) { + tx = db.getInstance() + tx.Statement.scopes = append(tx.Statement.scopes, funcs...) + return tx } // Preload preload associations with given conditions