Module: AbstractController::Callbacks
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
|
Classes:
| |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
::ActionController::API,
::ActionController::Base,
::ActionController::ContentSecurityPolicy,
::ActionController::RequestForgeryProtection,
::ActionMailer::Base,
::ActionView::TestCase::TestController,
::Rails::ApplicationController,
::Rails::HealthController,
::Rails::InfoController,
::Rails::MailersController,
::Rails::PwaController,
::Rails::WelcomeController
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
|
|
| Defined in: | actionpack/lib/abstract_controller/callbacks.rb |
Overview
Abstract Controller provides hooks during the life cycle of a controller action. Callbacks allow you to trigger logic during this cycle. Available callbacks are:
-
after_action -
append_after_action -
append_around_action -
append_before_action -
around_action -
before_action -
prepend_after_action -
prepend_around_action -
prepend_before_action -
skip_after_action -
skip_around_action -
skip_before_action
Constant Summary
::ActiveSupport::Callbacks - Included
::ActiveSupport::Callbacks - Attributes & Methods
- .__callbacks rw
- #__callbacks readonly
Class Method Summary
::ActiveSupport::DescendantsTracker - self
::ActiveSupport::Concern - Extended
| class_methods | Define class methods from given block. |
| included | Evaluate given block in context of base class, so that you can write class macros here. |
| prepended | Evaluate given block in context of base class, so that you can write class macros here. |
| append_features, prepend_features | |
Instance Method Summary
-
#process_action
private
Override Base#process_action to run the #process_action callbacks around the normal behavior.
::ActiveSupport::Callbacks - Included
| #run_callbacks | Runs the callbacks for the given event. |
| #halted_callback_hook | A hook invoked every time a before callback is halted. |
DSL Calls
included
[ GitHub ]32 33 34 35 36 37
# File 'actionpack/lib/abstract_controller/callbacks.rb', line 32
included do define_callbacks :process_action, terminator: ->(controller, result_lambda) { result_lambda.call; controller.performed? }, skip_after_callbacks_if_terminated: true mattr_accessor :raise_on_missing_callback_actions, default: false end
Class Attribute Details
.__callbacks (rw)
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 69
class_attribute :__callbacks, instance_writer: false, instance_predicate: false, default: {}
Instance Attribute Details
#__callbacks (readonly)
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 69
class_attribute :__callbacks, instance_writer: false, instance_predicate: false, default: {}
Instance Method Details
#process_action (private)
Override Base#process_action to run the process_action callbacks around the normal behavior.
# File 'actionpack/lib/abstract_controller/callbacks.rb', line 259
def process_action(...) run_callbacks(:process_action) do super end end