Merge pull request #767 from levinalex/patch-1

clean up wording in README
This commit is contained in:
Jinzhu 2015-12-18 20:17:59 +08:00
commit d209be3138
1 changed files with 4 additions and 4 deletions

View File

@ -1064,10 +1064,10 @@ func (u *User) AfterCreate() (err error) {
} }
``` ```
As you know, save/delete operations in gorm are running in a transaction, Save/delete operations in gorm are running in a transaction.
This is means if changes made in the transaction is not visiable unless it is commited, Changes made in that transaction are not visible unless it is commited.
So if you want to use those changes in your callbacks, you need to run SQL in same transaction. So if you want to use those changes in your callbacks, you need to run your SQL in the same transaction.
Fortunately, gorm support pass transaction to callbacks as you needed, you could do it like this: For this Gorm supports passing transactions to callbacks like this:
```go ```go
func (u *User) AfterCreate(tx *gorm.DB) (err error) { func (u *User) AfterCreate(tx *gorm.DB) (err error) {