diff --git a/gorm.go b/gorm.go index 9323c46d..b612e1f4 100644 --- a/gorm.go +++ b/gorm.go @@ -116,9 +116,9 @@ func Open(dialector Dialector, opts ...Option) (db *DB, err error) { if err := opt.Apply(config); err != nil { return nil, err } - defer func() { + defer func(opt Option) { opt.AfterInitialize(db) - }() + }(opt) } }