Reputation: 25
I am almost done with a Ruby web application which is a forum. I have only one trouble: When a user is sent reset password instructions and clicks on "forgot my password", I see this error:
Showing C:/ruby/lib/ruby/gems/2.1.0/gems/devise-3.4.1/app/views/devise/mailer/reset_password_instructions.html.erb where line #5 raised:
Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
What can I do?
Upvotes: 0
Views: 55
Reputation: 1318
Looks like you need to specify your host
in your environments.
So, say in your production.rb
file, you would need something like this:
config.action_mailer.default_url_options = { host: www.yourhostname.com }
and in development.rb
, something like this:
config.action_mailer.default_url_options = { host: "dev.yourhostname.com" }
and so on for for your test environment.
Some info from the docs.
Upvotes: 1
Reputation: 23949
Your error message is:
Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
In config.action_mailer.default_url_options
, you need to set a :host
parameter, so the server knows how to link back to itself. The server doesn't know its domain name or IP address to use.
So in your config/production.rb
try setting something like this:
config.action_mailer.default_url_options = { host: 'www.example.com' }
Upvotes: 0