module Mongoid::Interceptable::ClassMethods
Public Instance Methods
observable(*args)
click to toggle source
Set a custom callback as able to be observed.
@example Set a custom callback as observable.
class Band include Mongoid::Document define_model_callbacks :notification observable :notification end
@param [ Array<Symbol> ] args The names of the observable callbacks.
@since 3.0.1
# File lib/mongoid/observers/interceptable.rb, line 44 def observable(*args) observables = args.flat_map do |name| [ :"before_#{name}", :"after_#{name}", :"around_#{name}" ] end Interceptable.registered_observables.concat(observables).uniq end