module ActionDispatch::Routing::UrlFor
def url_for(options = nil)
url_for :controller => 'tasks', :action => 'testing', :trailing_slash=>true # => 'http://somehost.org/tasks/testing/'
url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :anchor => 'ok', :only_path => true # => '/tasks/testing#ok'
url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :port=>'8080' # => 'http://somehost.org:8080/tasks/testing'
Examples:
+url_for+ is forwarded to the Routes module.
Any other key (:controller, :action, etc.) given to
* :trailing_slash - If true, adds a trailing slash, as in "/archive/2009/"
* :anchor - An anchor name to be appended to the path.
* :port - Optionally specify the port to connect to.
provided either explicitly, or via +default_url_options+.
If :only_path is false, this option must be
* :host - Specifies the host the link should be targeted at.
* :protocol - The protocol to connect to. Defaults to 'http'.
* :only_path - If true, the relative url is returned. Defaults to +false+.
routes defined in routes.rb. The following options are supported:
Generate a url based on the options provided, default_url_options and the
def url_for(options = nil) case options when String options when nil, Hash _routes.url_for((options || {}).reverse_merge!(url_options).symbolize_keys) else polymorphic_url(options) end end
def url_options
def url_options default_url_options end