mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
routes in the env via the request object
This commit is contained in:
parent
df71e48be8
commit
a31bfe6983
2 changed files with 6 additions and 3 deletions
|
@ -110,6 +110,10 @@ module ActionDispatch
|
|||
env["action_dispatch.routes".freeze]
|
||||
end
|
||||
|
||||
def routes=(routes) # :nodoc:
|
||||
env["action_dispatch.routes".freeze] = routes
|
||||
end
|
||||
|
||||
def original_script_name # :nodoc:
|
||||
env['ORIGINAL_SCRIPT_NAME'.freeze]
|
||||
end
|
||||
|
|
|
@ -520,15 +520,14 @@ module Rails
|
|||
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)
|
||||
end
|
||||
|
||||
# Defines additional Rack env configuration that is added on each call.
|
||||
def env_config
|
||||
@env_config ||= {
|
||||
'action_dispatch.routes' => routes
|
||||
}
|
||||
@env_config ||= {}
|
||||
end
|
||||
|
||||
# Defines the routes for this engine. If a block is given to
|
||||
|
|
Loading…
Reference in a new issue