diff options
author | Carl Lerche <carllerche@mac.com> | 2010-03-04 21:59:42 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-03-04 22:00:30 -0800 |
commit | 9a17416d8bda0df0a6961e547c3cf1d677e66b5e (patch) | |
tree | 4c6dba8298cc9f1e1224521edc696e66aeda82f9 /actionpack/lib/action_controller | |
parent | 48672cd1997618f21f50e1204e60dc681e647ddb (diff) | |
download | rails-9a17416d8bda0df0a6961e547c3cf1d677e66b5e.tar.gz rails-9a17416d8bda0df0a6961e547c3cf1d677e66b5e.tar.bz2 rails-9a17416d8bda0df0a6961e547c3cf1d677e66b5e.zip |
Tweak out url_for uses :script_name and add some tests
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/url_for.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 4 |
3 files changed, 2 insertions, 14 deletions
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index 89ab0b4753..f6b6cb2ff4 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -9,12 +9,8 @@ module ActionController super.reverse_merge( :host => request.host_with_port, :protocol => request.protocol, - # ROUTES TODO: relative_url_root should be middleware - # and the generator should take SCRIPT_NAME into - # consideration - :script_name => request.env["SCRIPT_NAME"], :_path_segments => request.symbolized_path_parameters - ) + ).merge(:script_name => request.script_name) end def _router diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index e638be5251..e9edf80451 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -51,12 +51,6 @@ 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 8821892b3a..981865517f 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -32,7 +32,6 @@ module ActionController # ROUTES TODO: Fix the tests segments = options.delete(:_path_segments) - relative_url_root = options.delete(:script_name).to_s path_segments = path_segments ? path_segments.merge(segments || {}) : segments unless options[:only_path] @@ -50,8 +49,7 @@ module ActionController path_options = yield(path_options) if block_given? path = router.generate(path_options, path_segments || {}) - # ROUTES TODO: This can be called directly, so relative_url_root should probably be set in the router - rewritten_url << relative_url_root + # ROUTES TODO: This can be called directly, so script_name should probably be set in the router rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path) rewritten_url << "##{Rack::Utils.escape(options[:anchor].to_param.to_s)}" if options[:anchor] |