aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-04-18 17:14:52 -0500
committerJoshua Peek <josh@joshpeek.com>2008-04-18 17:14:52 -0500
commit29ea0f68aa515f29fe440dabf6d40807e348b703 (patch)
treeef9b6c1f38876f2beaf8a9f4b3aac5d20bf95c31
parent36eecda8d0b5ebd3341692868b8faeec8fbce9d0 (diff)
parenta4c15303cbc96fffd66c68abdeebe73d8883e5ab (diff)
downloadrails-29ea0f68aa515f29fe440dabf6d40807e348b703.tar.gz
rails-29ea0f68aa515f29fe440dabf6d40807e348b703.tar.bz2
rails-29ea0f68aa515f29fe440dabf6d40807e348b703.zip
Merge branch 'master' of git@github.com:josh/rails
-rw-r--r--activesupport/lib/active_support/callbacks.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index 282b6cbcbc..5c51237049 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -97,15 +97,14 @@ module ActiveSupport
end
def |(chain)
- if chain.is_a?(Callback)
- if found_callback = find(chain)
- index = index(found_callback)
+ if chain.is_a?(CallbackChain)
+ chain.each { |callback| self | callback }
+ elsif chain.is_a?(Callback)
+ if index = index(chain)
self[index] = chain
else
self << chain
end
- else
- chain.each { |callback| self | callback }
end
self
end
@@ -115,7 +114,7 @@ module ActiveSupport
end
def delete(callback)
- super(find(callback))
+ super(callback.is_a?(Callback) ? callback : find(callback))
end
private