Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Expose MiddlewareStack#unshift to environment configuration.

  • Loading branch information...
commit 4de8851289077239ecc91473bdba30f8cf6727bb 1 parent 941516d
@benpickles benpickles authored
View
4 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*
View
4 railties/lib/rails/configuration.rb
@@ -59,6 +59,10 @@ def delete(*args, &block)
@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)
View
6 railties/test/application/middleware_test.rb
@@ -144,6 +144,12 @@ def app
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!
Please sign in to comment.
Something went wrong with that request. Please try again.