diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-01-28 17:42:26 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-01-28 17:42:48 -0800 |
commit | f142527eb30626904cb1e655a1a28801f08b8acf (patch) | |
tree | c4007bd8fcf6e84cf97063c26c12b9f541677b99 /actionpack | |
parent | dd6488de51461ff660f49110bec091317efaca08 (diff) | |
download | rails-f142527eb30626904cb1e655a1a28801f08b8acf.tar.gz rails-f142527eb30626904cb1e655a1a28801f08b8acf.tar.bz2 rails-f142527eb30626904cb1e655a1a28801f08b8acf.zip |
always use a block for cleanup / prepare callbacks so we can clean the method signature
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/reloader.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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 |