Skip to content
Browse files

Don't deprecate to_prepare.

  • Loading branch information...
1 parent 819b8ca commit d6efd3cfc2c6d6822aeac550852c49135fbe46c7 @josevalim josevalim committed Dec 23, 2010
View
8 actionpack/lib/action_dispatch/middleware/callbacks.rb
@@ -1,14 +1,14 @@
+require 'active_support/core_ext/module/delegation'
+
module ActionDispatch
# Provide callbacks to be executed before and after the request dispatch.
class Callbacks
include ActiveSupport::Callbacks
define_callbacks :call, :rescuable => true
- def self.to_prepare(*args, &block)
- ActiveSupport::Deprecation.warn "ActionDispatch::Callbacks.to_prepare is deprecated. " <<
- "Please use ActionDispatch::Reloader.to_prepare instead."
- ActionDispatch::Reloader.to_prepare(*args, &block)
+ class << self
+ delegate :to_prepare, :to_cleanup, :to => "ActionDispatch::Reloader"
end
def self.before(*args, &block)
View
12 actionpack/test/dispatch/callbacks_test.rb
@@ -29,14 +29,16 @@ def test_before_and_after_callbacks
assert_equal 4, Foo.b
end
- def test_to_prepare_deprecation
- prepared = false
- assert_deprecated do
- ActionDispatch::Callbacks.to_prepare { prepared = true }
- end
+ def test_to_prepare_and_cleanup_delegation
+ prepared = cleaned = false
+ ActionDispatch::Callbacks.to_prepare { prepared = true }
+ ActionDispatch::Callbacks.to_prepare { cleaned = true }
ActionDispatch::Reloader.prepare!
assert prepared
+
+ ActionDispatch::Reloader.cleanup!
+ assert cleaned
end
private

0 comments on commit d6efd3c

Please sign in to comment.
Something went wrong with that request. Please try again.