From a61360688cd0e1f43f523866384d0d0796a4ea73 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 20 Mar 2005 22:02:22 +0000 Subject: Changed .htaccess to allow dispatch.* to be called from a sub-directory as part of the push with Action Pack to make Rails work on non-vhost setups #826 [Nicholas Seckar/Tobias Luetke] Fixed routing and helpers to make Rails work on non-vhost setups #826 [Nicholas Seckar/Tobias Luetke] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@945 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/url_rewriter.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_controller/url_rewriter.rb') diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index bbfa6009a4..3e6ccf7a06 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -2,13 +2,13 @@ module ActionController # Rewrites URLs for Base.redirect_to and Base.url_for in the controller. class UrlRewriter #:nodoc: - RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol] + RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :application_prefix] def initialize(request, parameters) @request, @parameters = request, parameters @rewritten_path = @request.path ? @request.path.dup : "" end - def rewrite(options = {}) + def rewrite(options = {}) rewrite_url(rewrite_path(options), options) end @@ -20,11 +20,12 @@ module ActionController private def rewrite_url(path, options) + rewritten_url = "" rewritten_url << (options[:protocol] || @request.protocol) unless options[:only_path] rewritten_url << (options[:host] || @request.host_with_port) unless options[:only_path] - rewritten_url << options[:application_prefix] if options[:application_prefix] + rewritten_url << (options[:application_prefix] || @request.relative_url_root) rewritten_url << path rewritten_url << "##{options[:anchor]}" if options[:anchor] -- cgit v1.2.3