diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-20 22:02:22 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-20 22:02:22 +0000 |
commit | a61360688cd0e1f43f523866384d0d0796a4ea73 (patch) | |
tree | dfa09275f2165b1af8363642b67d85b5702cf793 /actionpack/lib/action_controller/url_rewriter.rb | |
parent | ee8d110068e958b400987b5f224e14e292fd0558 (diff) | |
download | rails-a61360688cd0e1f43f523866384d0d0796a4ea73.tar.gz rails-a61360688cd0e1f43f523866384d0d0796a4ea73.tar.bz2 rails-a61360688cd0e1f43f523866384d0d0796a4ea73.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller/url_rewriter.rb')
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 7 |
1 files changed, 4 insertions, 3 deletions
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] |