When a rails 4 application is hosted on a subdomain, for example. sub.domain.com, how can you get the urls in the action mailer templates to correctly reference the subobject?
configurations / environment / production.rb:
config.action_mailer.default_url_options = { :host => 'sub.domain.com' }
Example action mailer template:
<%= user_url(@user) %>
In the email, the link appears as www.domain.com/users/1, rather thansub.domain.com/users/1
source
share