Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::Template::Error: Missing host to link to! #22

Open
justinwiley opened this issue Oct 22, 2014 · 1 comment
Open

ActionView::Template::Error: Missing host to link to! #22

justinwiley opened this issue Oct 22, 2014 · 1 comment

Comments

@justinwiley
Copy link

I'm using Rails 4.1, and getting:

ActionView::Template::Error:
       Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true

...when running on a template that contains asset paths. I was able to solve this by updating production.rb, development.rb etc to set Rails.application.routes.default_url_options:

Rails.application.routes.default_url_options = config.action_mailer.default_url_options = { :host => 'examplecom', :protocol => 'https' }

This seems to work, but since I can imagine this is a common issue, wondering if there's a better way?

@hgani
Copy link

hgani commented Nov 15, 2015

I am also looking for a better way to do this. In particular, I need to set the host dynamically but cannot simply modify default_url_options because it's not thread-safe.

May be the gem can implement a solution similar to the one described at http://inopinatus.org/2015/09/08/using-url-helpers-in-rails-activejob-background-jobs/

But the tricky thing is that instead of implementing it in the job/mailer, it needs to be implemented so that this works inside the template/partial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants