diff options
author | Carl Lerche <carllerche@mac.com> | 2009-05-27 11:02:13 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-27 16:15:53 -0700 |
commit | a5688fa9073dc8824d98071346e6cd9ae417eb72 (patch) | |
tree | 06ed305c581fb7199207f35e625aa58fe4e53b99 /actionpack/lib/action_controller/abstract | |
parent | 760cb633396a954b465ec0dd0344915185bddec1 (diff) | |
download | rails-a5688fa9073dc8824d98071346e6cd9ae417eb72.tar.gz rails-a5688fa9073dc8824d98071346e6cd9ae417eb72.tar.bz2 rails-a5688fa9073dc8824d98071346e6cd9ae417eb72.zip |
Add the ability to prepend filters to new callbacks
Diffstat (limited to 'actionpack/lib/action_controller/abstract')
-rw-r--r-- | actionpack/lib/action_controller/abstract/callbacks.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/abstract/callbacks.rb b/actionpack/lib/action_controller/abstract/callbacks.rb index e4f9dd3112..83dd06bf8b 100644 --- a/actionpack/lib/action_controller/abstract/callbacks.rb +++ b/actionpack/lib/action_controller/abstract/callbacks.rb @@ -37,6 +37,15 @@ module AbstractController end end + def prepend_#{filter}_filter(*names, &blk) + options = names.last.is_a?(Hash) ? names.pop : {} + _normalize_callback_options(options) + names.push(blk) if block_given? + names.each do |name| + process_action_callback(:#{filter}, name, options.merge(:prepend => true)) + end + end + def skip_#{filter}_filter(*names, &blk) options = names.last.is_a?(Hash) ? names.pop : {} _normalize_callback_options(options) |