Module: AbstractController::Callbacks
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
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::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
descendants | See additional method definition at line 104. |
subclasses | See additional method definition at line 100. |
::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. |
Instance Method Summary
::ActiveSupport::Callbacks
- Included
#run_callbacks | Runs the callbacks for the given event. |
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 70
class_attribute :__callbacks, instance_writer: false, default: {}
.__callbacks? ⇒ Boolean
(rw)
[ GitHub ]
# File 'activesupport/lib/active_support/callbacks.rb', line 70
class_attribute :__callbacks, instance_writer: false, default: {}
Instance Attribute Details
#__callbacks (readonly)
[ GitHub ]# File 'activesupport/lib/active_support/callbacks.rb', line 70
class_attribute :__callbacks, instance_writer: false, default: {}
#__callbacks? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activesupport/lib/active_support/callbacks.rb', line 70
class_attribute :__callbacks, instance_writer: false, default: {}