method
rewrite_url
rails latest stable - Class:
ActionController::UrlRewriter
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.
rewrite_url(options)private
Given a path and options, returns a rewritten URL string
# File actionpack/lib/action_controller/url_rewriter.rb, line 176
def rewrite_url(options)
rewritten_url = ""
unless options[:only_path]
rewritten_url << (options[:protocol] || @request.protocol)
rewritten_url << "://" unless rewritten_url.match("://")
rewritten_url << rewrite_authentication(options)
rewritten_url << (options[:host] || @request.host_with_port)
rewritten_url << ":#{options.delete(:port)}" if options.key?(:port)
end
path = rewrite_path(options)
rewritten_url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root]
rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path)
rewritten_url << "##{CGI.escape(options[:anchor].to_param.to_s)}" if options[:anchor]
rewritten_url
end Related methods
- Instance methods
- rewrite
- to_s
- to_str
- Class methods
- new
- Private methods
-
rewrite_authentication -
rewrite_path -
rewrite_url