diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-07-07 11:26:03 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:05 +0200 |
commit | 451c9942bb493190d5673c1b55be7506056db13b (patch) | |
tree | 4570ad54ce7d5c9ff2cab6ab3697531ec903b7ca /actionpack/lib/action_dispatch/routing/url_for.rb | |
parent | 628b94fbc81cb02b753d0f717a875219853b5764 (diff) | |
download | rails-451c9942bb493190d5673c1b55be7506056db13b.tar.gz rails-451c9942bb493190d5673c1b55be7506056db13b.tar.bz2 rails-451c9942bb493190d5673c1b55be7506056db13b.zip |
Allow to generate Application routes inside Engine
This requires knowledge about original SCRIPT_NAME and
the parent router. It should be pass through the env
as ORIGIAL_SCRIPT_NAME and action_dispatch.parent_routes
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/url_for.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/url_for.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb index f73067688c..deaf1cdf03 100644 --- a/actionpack/lib/action_dispatch/routing/url_for.rb +++ b/actionpack/lib/action_dispatch/routing/url_for.rb @@ -129,9 +129,9 @@ module ActionDispatch options when nil, Hash routes = (options ? options.delete(:routes) : nil) || _routes - - if respond_to?(:env) && env && routes.equal?(env["action_dispatch.routes"]) - options[:skip_prefix] = true + if respond_to?(:env) && env + options[:skip_prefix] = true if routes.equal?(env["action_dispatch.routes"]) + options[:script_name] = env["ORIGINAL_SCRIPT_NAME"] if routes.equal?(env["action_dispatch.parent_routes"]) end routes.url_for((options || {}).reverse_merge!(url_options).symbolize_keys) |