Write URLs from arbitrary places in your codebase, such as your mailers.
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.
I’ve been upgradings an app to Rails 3 and it took me a bit to find this-
If you were using
to get the url helpers in rails 2, you should switch to
for Rails 3