I'm using Devise invitable for invitation. We're using different sub-domains like, test1.domain.com, test2.domain.com etc in a single rails app and would like the invitation url we send to users to reflect that.
Since the value seems to be based on the config var in config/production.rb:
config.action_mailer.default_url_options = { host: 'www.domain.com' }
It's not clear to me what the best way to change the url that used in the email view:
<%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, :invitation_token => @token) %>
I could not find the source of the accept_invitation_url so I'm not even sure where that is set.
Any help is greatly appreciated!
Rookie mistake:
The trick was to stop trying to search for this as an devise invitable question and more of a general ActionMailer question which led me to this simple solution: http://excid3.com/blog/change-actionmailer-email-url-host-dynamically/
Basically just reset the url in the application controller with any logic you want:
before_filter :set_mailer_host
def set_mailer_host
ActionMailer::Base.default_url_options[:host] = request.host_with_port
end