diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-04 17:43:46 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-03-04 17:43:46 -0800 |
commit | 900a2d304a83bad7a3958464b8dfa6fb49670686 (patch) | |
tree | 0890d17f239ac85509ed74a93b76c6409a7b1f38 /actionpack/lib/action_controller | |
parent | 3438373f038cefda664b879f49eec8aec6a15a76 (diff) | |
download | rails-900a2d304a83bad7a3958464b8dfa6fb49670686.tar.gz rails-900a2d304a83bad7a3958464b8dfa6fb49670686.tar.bz2 rails-900a2d304a83bad7a3958464b8dfa6fb49670686.zip |
Get rid of relative_url_path in favor of respecting SCRIPT_NAME. Also added a way to specify a default SCRIPT_NAME when generating URLs out of the context of a request.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/url_for.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index c890dc51d4..89ab0b4753 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -12,7 +12,7 @@ module ActionController # ROUTES TODO: relative_url_root should be middleware # and the generator should take SCRIPT_NAME into # consideration - :relative_url_root => config.relative_url_root, + :script_name => request.env["SCRIPT_NAME"], :_path_segments => request.symbolized_path_parameters ) end diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index e9edf80451..e638be5251 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -51,6 +51,12 @@ module ActionController ac.stylesheets_dir = paths.public.stylesheets.to_a.first ac.secret = app.config.cookie_secret + if ac.relative_url_root + ActiveSupport::Deprecation.warn "config.action_controller.relative_url_root " \ + "is no longer effective. Please set it in the router as " \ + "routes.draw(:script_name => #{ac.relative_url_root.inspect})" + end + ActionController::Base.config.replace(ac) end diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index 973a6facd7..8821892b3a 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -32,7 +32,7 @@ module ActionController # ROUTES TODO: Fix the tests segments = options.delete(:_path_segments) - relative_url_root = options.delete(:relative_url_root).to_s + relative_url_root = options.delete(:script_name).to_s path_segments = path_segments ? path_segments.merge(segments || {}) : segments unless options[:only_path] |