instance method
_normalize_callback_options
Ruby on Rails 6.0.6
Since v3.0.20Signature
_normalize_callback_options(options)
If :only or :except are used, convert the options into the :if and :unless options of ActiveSupport::Callbacks.
The basic idea is that :only => :index gets converted to :if => proc {|c| c.action_name == "index" }.
Note that :only has priority over :if in case they are used together.
only: :index, if: -> { true } # the :if option will be ignored.
Note that :if has priority over :except in case they are used together.
except: :index, if: -> { true } # the :except option will be ignored.
Options
-
only- The callback should be run only for this action. -
except- The callback should be run for all actions except this action.
Parameters
-
optionsreq
Source
# File actionpack/lib/abstract_controller/callbacks.rb, line 66
def _normalize_callback_options(options)
_normalize_callback_option(options, :only, :if)
_normalize_callback_option(options, :except, :unless)
end
Defined in actionpack/lib/abstract_controller/callbacks.rb line 66
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in AbstractController::Callbacks::ClassMethods