An ActiveRecord callback that is executed after validating an object but before writing it to the database.
before_save
is one of the standard ActiveRecord callbacks. There are three sets of callbacks:
- Creating an Object (in order of execution):
before_validation
after_validation
before_save
around_save
before_create
around_create
after_create
after_save
- Updating an Object (in order of execution):
before_validation
after_validation
before_save
around_save
before_update
around_update
after_update
after_save
- Destroying an Object (in order of execution):
before_destroy
around_destroy
after_destroy