Skip to content

Instantly share code, notes, and snippets.

@nhattan
Created May 28, 2015 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhattan/b1f3beb18e752088f878 to your computer and use it in GitHub Desktop.
Save nhattan/b1f3beb18e752088f878 to your computer and use it in GitHub Desktop.
Missing host
# rails (4.2.0), devise (3.5.1)
# in config/environments/staging.rb
config.action_mailer.default_url_options = { host: ENV['HOSTNAME'] }
Rails.application.routes.default_url_options[:host] = ENV['HOSTNAME']
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: ENV['SMTP_SERVER'],
port: ENV['SMTP_PORT'],
user_name: ENV['SMTP_USER'],
password: ENV['SMTP_PASSWORD'],
authentication: :plain,
enable_starttls_auto: true
}
# staging.log
Devise::Mailer#confirmation_instructions: processed outbound mail in 6.5ms
D, [2015-05-28T03:42:08.523456 #3660] DEBUG -- : (2.2ms) ROLLBACK
I, [2015-05-28T03:42:08.528776 #3660] INFO -- : Completed 500 Internal Server Error in 127ms
F, [2015-05-28T03:42:08.533899 #3660] FATAL -- :
ActionView::Template::Error (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):
2:
3: <p>You can confirm your account email through the link below:</p>
4:
5: <p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
actionpack (4.2.0) lib/action_dispatch/http/url.rb:45:in `full_url_for'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment