skip_callback

skip_callback(name, *filter_list, &block) Instance Public methods Skip a previously set callback. Like set_callback, :if or :unless options may be passed in order to control when the callback is skipped. class Writer < Person skip_callback :validate, :before, :check_membership, if: -> { self.age > 18 } end

set_callback

set_callback(name, *filter_list, &block) Instance Public methods Install a callback for the given event. set_callback :save, :before, :before_meth set_callback :save, :after, :after_meth, if: :condition set_callback :save, :around, ->(r, &block) { stuff; result = block.call; stuff } The second arguments indicates whether the callback is to be run :before, :after, or :around the event. If omitted, :before is assumed. This means the first example above can also be writte

reset_callbacks

reset_callbacks(name) Instance Public methods Remove all set callbacks for the given event.

define_callbacks

define_callbacks(*names) Instance Public methods Define sets of events in the object life cycle that support callbacks. define_callbacks :validate define_callbacks :initialize, :save, :destroy Options :terminator - Determines when a before filter will halt the callback chain, preventing following callbacks from being called and the event from being triggered. This should be a lambda to be executed. The current object and the return result of the callback will be called with the l

call

call(*args) Instance Public methods

before

before(&before) Instance Public methods

around

around(&around) Instance Public methods

after

after(&after) Instance Public methods

new

new(&call) Class Public methods

generate_key

generate_key(salt, key_size=64) Instance Public methods Returns a derived key suitable for use. The default key_size is chosen to be compatible with the default settings of ActiveSupport::MessageVerifier. i.e. OpenSSL::Digest::SHA1#block_length