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 /activesupport/lib | |
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 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/new_callbacks.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb index b6cbdbb6b0..e9a30b9c35 100644 --- a/activesupport/lib/active_support/new_callbacks.rb +++ b/activesupport/lib/active_support/new_callbacks.rb @@ -464,7 +464,9 @@ module ActiveSupport self._#{symbol}_callbacks.delete_if {|c| c.matches?(type, :#{symbol}, filter)} Callback.new(filter, type, options.dup, self, :#{symbol}) end - self._#{symbol}_callbacks.push(*filters) + options[:prepend] ? + self._#{symbol}_callbacks.unshift(*filters) : + self._#{symbol}_callbacks.push(*filters) _define_runner(:#{symbol}, self._#{symbol}_callbacks.compile(nil, :terminator => _#{symbol}_terminator), options) |