instance method
_normalize_callback_options
Ruby on Rails 3.0.20
Since v3.0.20Signature
_normalize_callback_options(options)
If :only or :except are used, convert the options into the primitive form (:per_key) used by ActiveSupport::Callbacks. The basic idea is that :only => :index gets converted to :if => proc {|c| c.action_name == “index” }, but that the proc is only evaluated once per action for the lifetime of a Rails process.
Options
-
only- The callback should be run only for this action -
<tt>except<tt> - The callback should be run for all actions except this action
Parameters
-
optionsreq
Source
# File actionpack/lib/abstract_controller/callbacks.rb, line 33
def _normalize_callback_options(options)
if only = options[:only]
only = Array(only).map {|o| "action_name == '#{o}'"}.join(" || ")
options[:per_key] = {:if => only}
end
if except = options[:except]
except = Array(except).map {|e| "action_name == '#{e}'"}.join(" || ")
options[:per_key] = {:unless => except}
end
end
Defined in actionpack/lib/abstract_controller/callbacks.rb line 33
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in AbstractController::Callbacks::ClassMethods