What is the difference between `after_create` and `after_save` and when to use which?

后端 未结 3 469
独厮守ぢ
独厮守ぢ 2020-12-04 15:19

Are after_create and after_save the same as per functionality?

I want to do an operation with the email of a user after its account creatio

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 15:40

    From the docs:

    after_create()

    Is called after Base.save on new objects that haven‘t been saved yet (no record exists).

    after_save()

    Is called after Base.save (regardless of whether it‘s a create or update save).

提交回复
热议问题