diff options
author | Ben Pickles <spideryoung@gmail.com> | 2013-10-09 11:16:22 +0100 |
---|---|---|
committer | Ben Pickles <spideryoung@gmail.com> | 2013-10-09 12:25:29 +0100 |
commit | 4de8851289077239ecc91473bdba30f8cf6727bb (patch) | |
tree | bfb9c7a2ff31fe7ad168f3df4f3fded34cb83664 | |
parent | 941516dabcc5fd02eb736f457197bd115c85f2fb (diff) | |
download | rails-4de8851289077239ecc91473bdba30f8cf6727bb.tar.gz rails-4de8851289077239ecc91473bdba30f8cf6727bb.tar.bz2 rails-4de8851289077239ecc91473bdba30f8cf6727bb.zip |
Expose MiddlewareStack#unshift to environment configuration.
-rw-r--r-- | railties/CHANGELOG.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/configuration.rb | 4 | ||||
-rw-r--r-- | railties/test/application/middleware_test.rb | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index a4babbe8c3..4e6bf899af 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,7 @@ +* Expose MiddlewareStack#unshift to environment configuration. + + *Ben Pickles* + * Include `web-console` into newly generated applications' Gemfile. *Genadi Samokovarov* diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index c694513960..f5d7dede66 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -59,6 +59,10 @@ module Rails @operations << [__method__, args, block] end + def unshift(*args, &block) + @operations << [__method__, args, block] + end + def merge_into(other) #:nodoc: @operations.each do |operation, args, block| other.send(operation, *args, &block) diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index 31a35a09bb..20d1d76d78 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -144,6 +144,12 @@ module ApplicationTests assert_equal "Rack::Config", middleware.second end + test 'unshift middleware' do + add_to_config 'config.middleware.unshift Rack::Config' + boot! + assert_equal 'Rack::Config', middleware.first + end + test "Rails.cache does not respond to middleware" do add_to_config "config.cache_store = :memory_store" boot! |