diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-23 18:59:24 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-23 18:59:24 +0000 |
commit | 00deaf6d56085d4961eff8e8e0948a9241dfd5ea (patch) | |
tree | 933aa1f6b17a6021590112509156c9247f3a6727 /actionpack/lib/action_controller | |
parent | 8e413262d6cca1ea3b481b7fd7ebf34320425285 (diff) | |
download | rails-00deaf6d56085d4961eff8e8e0948a9241dfd5ea.tar.gz rails-00deaf6d56085d4961eff8e8e0948a9241dfd5ea.tar.bz2 rails-00deaf6d56085d4961eff8e8e0948a9241dfd5ea.zip |
Added :host and :protocol options to url_for and friends to redirect to another host and protocol than the current.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@266 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index 493e4911c6..a3ff8fac32 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -1,7 +1,7 @@ module ActionController # Rewrites urls for Base.redirect_to and Base.url_for in the controller. class UrlRewriter #:nodoc: - VALID_OPTIONS = [:action, :action_prefix, :action_suffix, :module, :controller, :controller_prefix, :anchor, :params, :path_params, :id, :only_path, :overwrite_params ] + VALID_OPTIONS = [:action, :action_prefix, :action_suffix, :module, :controller, :controller_prefix, :anchor, :params, :path_params, :id, :only_path, :overwrite_params, :host, :protocol ] def initialize(request, controller, action) @request, @controller, @action = request, controller, action @@ -38,8 +38,8 @@ module ActionController def rewrite_url(path, options) rewritten_url = "" - rewritten_url << @request.protocol unless options[:only_path] - rewritten_url << @request.host_with_port unless options[:only_path] + rewritten_url << (options[:protocol] || @request.protocol) unless options[:only_path] + rewritten_url << (options[:host] || @request.host_with_port) unless options[:only_path] rewritten_url << path rewritten_url << build_query_string(new_parameters(options)) if options[:params] || options[:overwrite_params] |