diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 16 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 15 |
2 files changed, 17 insertions, 14 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index e3716992f5..175965e565 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -156,15 +156,6 @@ module Rails self end - # Implements call according to the Rack API. It simply - # dispatches the request to the underlying middleware stack. - def call(env) - req = ActionDispatch::Request.new env - env["ORIGINAL_FULLPATH"] = req.fullpath - env["ORIGINAL_SCRIPT_NAME"] = req.script_name - super(env) - end - # Reload application routes regardless if they changed or not. def reload_routes! routes_reloader.reload! @@ -517,6 +508,13 @@ module Rails private + def build_request(env) + req = super + env["ORIGINAL_FULLPATH"] = req.fullpath + env["ORIGINAL_SCRIPT_NAME"] = req.script_name + req + end + def build_middleware config.app_middleware + super end diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index a9d98a9d92..c4bb7d2109 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -523,11 +523,8 @@ module Rails # Define the Rack API for this engine. def call(env) - env.merge!(env_config) - req = ActionDispatch::Request.new env - req.routes = routes - req.engine_script_name = req.script_name - app.call(env) + req = build_request env + app.call req.env end # Defines additional Rack env configuration that is added on each call. @@ -697,6 +694,14 @@ module Rails private + def build_request(env) + env.merge!(env_config) + req = ActionDispatch::Request.new env + req.routes = routes + req.engine_script_name = req.script_name + req + end + def build_middleware config.middleware end |