Module: Admin::ListController::Callbacks

Extended by:
ActiveSupport::Concern
Included in:
Admin::ListController
Defined in:
app/controllers/admin/list_controller.rb

Overview

Provide before_render callbacks.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#render_with_callbacks(*args, &block) ⇒ Object

Helper method to run before_render callbacks and render the action. If a callback renders or redirects, the action is not rendered.


113
114
115
116
117
118
119
120
# File 'app/controllers/admin/list_controller.rb', line 113

def render_with_callbacks(*args, &block)
  options = _normalize_render(*args, &block)
  callback = "render_#{options[:template]}"

  run_callbacks(callback) if respond_to?(:"_#{callback}_callbacks", true)

  render_without_callbacks(*args, &block) unless performed?
end