As the title implies, I'm getting this error when I try to use link_to
in my mailer templates:
ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
I tried to follow it's instructions, and I also found this post, but I'm still getting the error.
I've tried adding config.action_mailer.default_url_options = { host: 'example.com' }
to each of the following files and none of them worked:
/config/environment.rb /config/application.rb (inside the module for my app) /config/development.rb (I'm in development mode)
Has something changed in Rails 4 that makes this work differently?
I ran into this problem the other day and this is what ended up working for me:
Rails.application.routes.default_url_options[:host] = '???'
edit
This goes in each environment file - development.rb
, test.rb
and production.rb
(and more if you have them) with the corresponding host name in each one
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With