Skip to main content

Module callbacks

Module callbacks 

Source
Expand description

Active Record-style lifecycle callbacks.

A model implements Callbacks (all hooks default to no-op) and persists through run_create/run_update/run_destroy, which fire the hooks in Rails’ order around the supplied persistence step. A hook returning Err aborts before the record is written.

Traits§

Callbacks
Lifecycle hooks fired around persistence. Override the ones you need.

Functions§

run_create
Insert: before_validation → before_save → before_create → persist → after_create → after_save.
run_destroy
Destroy: before_destroy → persist → after_destroy.
run_update
Update: before_validation → before_save → before_update → persist → after_update → after_save.