aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/callbacks.rb
diff options
context:
space:
mode:
authorBogdan Gusiev <agresso@gmail.com>2012-02-03 14:27:15 +0200
committerBogdan Gusiev <agresso@gmail.com>2012-02-03 14:27:15 +0200
commit1c61f7e6cb2882907fa85fabbf147937f5cc07bf (patch)
tree3ff67f48ea7c10627614509b1c97d2c8dfc49d73 /actionpack/lib/abstract_controller/callbacks.rb
parent2abaa19e77d1097730cfa6e0924ee7c1660ac01f (diff)
downloadrails-1c61f7e6cb2882907fa85fabbf147937f5cc07bf.tar.gz
rails-1c61f7e6cb2882907fa85fabbf147937f5cc07bf.tar.bz2
rails-1c61f7e6cb2882907fa85fabbf147937f5cc07bf.zip
AC::Callbacks: remove usage of :per_key option from filters
Diffstat (limited to 'actionpack/lib/abstract_controller/callbacks.rb')
-rw-r--r--actionpack/lib/abstract_controller/callbacks.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/actionpack/lib/abstract_controller/callbacks.rb b/actionpack/lib/abstract_controller/callbacks.rb
index fffe3edac2..d61475c844 100644
--- a/actionpack/lib/abstract_controller/callbacks.rb
+++ b/actionpack/lib/abstract_controller/callbacks.rb
@@ -21,11 +21,9 @@ module AbstractController
module ClassMethods
# If :only or :except are used, convert the options into the
- # primitive form (:per_key) used by ActiveSupport::Callbacks.
+ # :unless and :if options of 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.
+ # :if => proc {|c| c.action_name == "index" }.
#
# ==== Options
# * <tt>only</tt> - The callback should be run only for this action
@@ -33,11 +31,11 @@ module AbstractController
def _normalize_callback_options(options)
if only = options[:only]
only = Array(only).map {|o| "action_name == '#{o}'"}.join(" || ")
- options[:per_key] = {:if => only}
+ options[:if] = Array(options[:if]) << only
end
if except = options[:except]
except = Array(except).map {|e| "action_name == '#{e}'"}.join(" || ")
- options[:per_key] = {:unless => except}
+ options[:unless] = Array(options[:unless]) << except
end
end