From f142527eb30626904cb1e655a1a28801f08b8acf Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 28 Jan 2014 17:42:26 -0800 Subject: always use a block for cleanup / prepare callbacks so we can clean the method signature --- actionpack/lib/action_dispatch/middleware/reloader.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/middleware/reloader.rb b/actionpack/lib/action_dispatch/middleware/reloader.rb index 432a072b1b..15b5a48535 100644 --- a/actionpack/lib/action_dispatch/middleware/reloader.rb +++ b/actionpack/lib/action_dispatch/middleware/reloader.rb @@ -1,3 +1,5 @@ +require 'active_support/deprecation/reporting' + module ActionDispatch # ActionDispatch::Reloader provides prepare and cleanup callbacks, # intended to assist with code reloading during development. @@ -25,6 +27,7 @@ module ActionDispatch # class Reloader include ActiveSupport::Callbacks + include ActiveSupport::Deprecation::Reporting define_callbacks :prepare define_callbacks :cleanup @@ -32,12 +35,18 @@ module ActionDispatch # Add a prepare callback. Prepare callbacks are run before each request, prior # to ActionDispatch::Callback's before callbacks. def self.to_prepare(*args, &block) + unless block_given? + warn "to_prepare without a block is deprecated. Please use a block" + end set_callback(:prepare, *args, &block) end # Add a cleanup callback. Cleanup callbacks are run after each request is # complete (after #close is called on the response body). def self.to_cleanup(*args, &block) + unless block_given? + warn "to_cleanup without a block is deprecated. Please use a block" + end set_callback(:cleanup, *args, &block) end -- cgit v1.2.3