Ruby on Rails Callback, what is difference between :before_save and :before_create?
|
In a create operation under Rails, there are six callbacks before the database operation, and two after. In order, these are:
Update operations have exactly the same set, except read From this, you can see that validation is carried out before the The |
before_save is called every time an object is saved. So for new and existing objects. (create and update action)
before_create only before creation. So only for new objects (create action)

浙公网安备 33010602011771号