url_for(options = nil)public
Basic implementation of url_for to allow use helpers without routes existence
# File actionview/lib/action_view/helpers/url_helper.rb, line 31 def url_for(options = nil) # :nodoc: case options when String options when :back _back_url else raise ArgumentError, "arguments passed to url_for can't be handled. Please require " + "routes or provide your own implementation" end end
Emails need a fully qualified URL (with domain). Use the :host parameter.
But note also that you need to specify a value that is not dependent upon the request context. http://api.rubyonrails.org/classes/ActionMailer/Base.html recommends setting a default host in application.rb For those of us who have development, test, staging and production environments, set in the environment-specific files, or in the :default hash in the mailer.
This applies to both +url_for(:host => “example.com”)+ and when using named routes as in +widgets_url(:host => “example.com”)+