Monday 29 July 2013

default_url_options[:host] fails with http://

This is something that gets me every single time. If you set up your code as follows (in the config/environments/development.rb file:

config.action_mailer.default_url_options =  {host: 'http://localhost:3000'}

then any links you have in there will not work correctly as they will be pointing to http://http://localhost:3000, which will break email clients. Instead you have to do it without the protocol and it all works fine:

config.action_mailer.default_url_options =  {host: 'localhost:3000'}

No comments:

Post a Comment