Module: ActiveAdmin::Callbacks

Extended by:
ActiveSupport::Concern
Included in:
ResourceController::DataAccess
Defined in:
lib/active_admin/callbacks.rb

Defined Under Namespace

Modules: ClassMethods

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)



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

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