Module: ActiveAdmin::Callbacks::InstanceMethods

Defined in:
lib/active_admin/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#call_callback_with(method, *args) ⇒ Object (protected)

Simple callback system. Implements before and after callbacks for use within the controllers.

We didn’t use the ActiveSupport callbacks becuase they do not support passing in any arbitrary object into the callback method (which we need to do)



15
16
17
18
19
20
21
22
23
24
# File 'lib/active_admin/callbacks.rb', line 15

def call_callback_with(method, *args)
  case method
  when Symbol
    send(method, *args)
  when Proc
    instance_exec(*args, &method)
  else
    raise "Please register with callbacks using a symbol or a block/proc."
  end
end