| Module | ActionController::UrlWriter |
| In: |
lib/action_controller/url_rewriter.rb
|
Write URLs from arbitrary places in your codebase, such as your mailers.
Example:
class MyMailer
include ActionController::UrlWriter
default_url_options[:host] = 'www.basecamphq.com'
def signup_url(token)
url_for(:controller => 'signup', action => 'index', :token => token)
end
end
In addition to providing url_for, named routes are also accessible after including UrlWriter.
Generate a url with the provided options. The following special options may effect the constructed url:
* :host Specifies the host the link should be targetted at. This option
must be provided either explicitly, or via default_url_options.
* :protocol The protocol to connect to. Defaults to 'http'
* :port Optionally specify the port to connect to.