We have an application with a javascript front-end that uses navigo library to create routes.
I would like to create a link in a email using the navigo notation. The problem is that if I create a link with link_to
passing only the path to navigo, like this:
link_to 'Some link', '/#/some/custom/path'
it will, as it should, put only the /#/some/custom/path
in the link href
attribute.
According to Rails Guides, if I set the config:
config.action_mailer.default_url_options = { host: 'example.com' }
It will add the host to links created with link_to in the mailer.
Question is, since I'm not using the path
or url
notation with link_to, how could I create a link to the site, that uses this host property? (Because we have staging, and production servers, and the address can change)
If you set the action_mailer options
link_to 'Some link', Rails.configuration.action_mailer.default_url_options[:host] + '/#/some/custom/path'
Will give you 'example.com/#/some/custom/path'