aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md3
-rw-r--r--railties/lib/rails/application.rb2
-rw-r--r--railties/lib/rails/application/bootstrap.rb2
-rw-r--r--railties/lib/rails/application/default_middleware_stack.rb1
-rw-r--r--railties/lib/rails/generators/base.rb4
-rw-r--r--railties/test/application/middleware_test.rb20
6 files changed, 16 insertions, 16 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index 6822507630..3e45a09dec 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,6 +1,3 @@
-* Removed Rack::Runtime from the default stack. It can be added back via
- `config.middleware.use ::Rack::Runtime`.
-
* Add fail fast to `bin/rails test`
Adding `--fail-fast` or `-f` when running tests will interrupt the run on
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 175965e565..7916e24af1 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -161,7 +161,7 @@ module Rails
routes_reloader.reload!
end
- # Return the application's KeyGenerator
+ # Returns the application's KeyGenerator
def key_generator
# number of iterations selected based on consultation with the google security
# team. Details at https://github.com/rails/rails/pull/6952#issuecomment-7661220
diff --git a/railties/lib/rails/application/bootstrap.rb b/railties/lib/rails/application/bootstrap.rb
index 85c282783b..9baf8aa742 100644
--- a/railties/lib/rails/application/bootstrap.rb
+++ b/railties/lib/rails/application/bootstrap.rb
@@ -63,7 +63,7 @@ INFO
Rails.cache = ActiveSupport::Cache.lookup_store(config.cache_store)
if Rails.cache.respond_to?(:middleware)
- config.middleware.insert_before(::ActionDispatch::RequestId, Rails.cache.middleware)
+ config.middleware.insert_before(::Rack::Runtime, Rails.cache.middleware)
end
end
end
diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb
index b2185ca818..21062f3a53 100644
--- a/railties/lib/rails/application/default_middleware_stack.rb
+++ b/railties/lib/rails/application/default_middleware_stack.rb
@@ -47,6 +47,7 @@ module Rails
end
end
+ middleware.use ::Rack::Runtime
middleware.use ::Rack::MethodOverride unless config.api_only
middleware.use ::ActionDispatch::RequestId
diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb
index 6fa413f8b0..c72ec400a0 100644
--- a/railties/lib/rails/generators/base.rb
+++ b/railties/lib/rails/generators/base.rb
@@ -302,13 +302,13 @@ module Rails
default_for_option(Rails::Generators.options, name, options, options[:default])
end
- # Return default aliases for the option name given doing a lookup in
+ # Returns default aliases for the option name given doing a lookup in
# Rails::Generators.aliases.
def self.default_aliases_for_option(name, options)
default_for_option(Rails::Generators.aliases, name, options, options[:aliases])
end
- # Return default for the option name given doing a lookup in config.
+ # Returns default for the option name given doing a lookup in config.
def self.default_for_option(config, name, options, default)
if generator_name and c = config[generator_name.to_sym] and c.key?(name)
c[name]
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index 490f0ba822..138c63266e 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -27,8 +27,9 @@ module ApplicationTests
"Rack::Sendfile",
"ActionDispatch::Static",
"ActionDispatch::LoadInterlock",
- "Rack::MethodOverride",
"ActiveSupport::Cache::Strategy::LocalCache",
+ "Rack::Runtime",
+ "Rack::MethodOverride",
"ActionDispatch::RequestId",
"Rails::Rack::Logger", # must come after Rack::MethodOverride to properly log overridden methods
"ActionDispatch::ShowExceptions",
@@ -58,6 +59,7 @@ module ApplicationTests
"ActionDispatch::Static",
"ActionDispatch::LoadInterlock",
"ActiveSupport::Cache::Strategy::LocalCache",
+ "Rack::Runtime",
"ActionDispatch::RequestId",
"Rails::Rack::Logger", # must come after Rack::MethodOverride to properly log overridden methods
"ActionDispatch::ShowExceptions",
@@ -166,19 +168,19 @@ module ApplicationTests
end
test "can delete a middleware from the stack even if insert_before is added after delete" do
- add_to_config "config.middleware.delete ActionDispatch::ShowExceptions"
- add_to_config "config.middleware.insert_before(ActionDispatch::ShowExceptions, Rack::Config)"
+ add_to_config "config.middleware.delete Rack::Runtime"
+ add_to_config "config.middleware.insert_before(Rack::Runtime, Rack::Config)"
boot!
assert middleware.include?("Rack::Config")
- assert_not middleware.include?("ActionDispatch::ShowExceptions")
+ assert_not middleware.include?("Rack::Runtime")
end
test "can delete a middleware from the stack even if insert_after is added after delete" do
- add_to_config "config.middleware.delete ActionDispatch::ShowExceptions"
- add_to_config "config.middleware.insert_after(ActionDispatch::ShowExceptions, Rack::Config)"
+ add_to_config "config.middleware.delete Rack::Runtime"
+ add_to_config "config.middleware.insert_after(Rack::Runtime, Rack::Config)"
boot!
assert middleware.include?("Rack::Config")
- assert_not middleware.include?("ActionDispatch::ShowExceptions")
+ assert_not middleware.include?("Rack::Runtime")
end
test "includes exceptions middlewares even if action_dispatch.show_exceptions is disabled" do
@@ -216,12 +218,12 @@ module ApplicationTests
test "Rails.cache does not respond to middleware" do
add_to_config "config.cache_store = :memory_store"
boot!
- assert_equal "Rack::MethodOverride", middleware.fourth
+ assert_equal "Rack::Runtime", middleware.fourth
end
test "Rails.cache does respond to middleware" do
boot!
- assert_equal "ActiveSupport::Cache::Strategy::LocalCache", middleware.fifth
+ assert_equal "Rack::Runtime", middleware.fifth
end
test "insert middleware before" do