I was wondering how to get url_for to work inside ActionMailer. I did
research on the web but I can’t seem to find something that fits what I
need.
In my application, each user can specify their custom domain to access
their. I have an ActionMailer that sends them notifications of changes
that occur. In there, I have a breadcrumbs helper method, which
generages something like:
Unfortunately, my email is using helper methods that are also used
throughout the application, so I don’t want to hardcode or pass around a
host variable everywhere (because there are a lot of URLs being
generated). I thought the ActionMailer::Base.default_url_options[:host]
would help but it doesn’t seem to work inside the scope of helper
methods.
Ryan W. wrote:
Use the :host option to make it build the whole URL, like this: