Apr 28

Create URL's outside of controllers and views

If you have a need to create URL’s outside of controllers and views include UrlWriter helper and set default_url_options.

include ActionController::UrlWriter
default_url_options = "www.example.com"

This way, you can create URL’s and use named routes from mailers, migrations, import scripts, etc. More info on Rails Framework Documentation

Tags: