Module: AbstractController::Callbacks
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Extension / Inclusion / Inheritance Descendants | |
Included In:
::ActionController::API ,
::ActionController::Base ,
::ActionController::ContentSecurityPolicy ,
::ActionController::ForceSSL ,
::ActionController::RequestForgeryProtection ,
::ActionMailer::Base ,
::ActionView::TestCase::TestController ,
Rails::ApplicationController,
Rails::InfoController,
Rails::MailersController,
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
NOTE: Calling the same callback multiple times will overwrite previous callback definitions.
Constant Summary
::ActiveSupport::Callbacks
- Included
::ActiveSupport::Callbacks
- Attributes & Methods
- .__callbacks rw
- #__callbacks readonly
- .__callbacks? ⇒ Boolean rw
- #__callbacks? ⇒ Boolean readonly
Class Method Summary
::ActiveSupport::DescendantsTracker
- self
clear, descendants, direct_descendants, | |
store_inherited | This is the only method that is not thread safe, but is only ever called during the eager loading phase. |
::ActiveSupport::Concern
- Extended
Instance Method Summary
-
#process_action(*args)
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. |
DSL Calls
included
[ GitHub ]32 33 34 35 36
# 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 end
Class Attribute Details
.__callbacks (rw)
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 67
class_attribute :__callbacks, instance_writer: false, default: {}
.__callbacks? ⇒ Boolean
(rw)
[ GitHub ]
# File 'activesupport/lib/active_support/callbacks.rb', line 67
class_attribute :__callbacks, instance_writer: false, default: {}
Instance Attribute Details
#__callbacks (readonly)
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 67
class_attribute :__callbacks, instance_writer: false, default: {}
#__callbacks? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activesupport/lib/active_support/callbacks.rb', line 67
class_attribute :__callbacks, instance_writer: false, default: {}
Instance Method Details
#process_action(*args)
Override Base#process_action to run the process_action
callbacks around the normal behavior.
# File 'actionpack/lib/abstract_controller/callbacks.rb', line 40
def process_action(*args) run_callbacks(:process_action) do super end end