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.
| Public Methods | |
|---|---|
| included | |
| url_ |
Generate a url based on the options provided, default_url_options and the routes defined in routes.rb. The following options are supported: |
<code/>and<pre/>for code samples.