ActiveModel::Callbacks
module ActiveModel::Callbacks
Active Model Callbacks
Provides an interface for any class to have Active Record like callbacks.
Like the Active Record methods, the callback chain is aborted as soon as one of the methods in the chain returns false
.
First, extend ActiveModel::Callbacks from the class you are creating:
class MyModel extend ActiveModel::Callbacks end
Then define a list of methods that you want callbacks attached to:
define_model_callbacks :create, :