facebook login via devise with confirm - error in production

在使用devise透過臉書登入並且有開啟comfirmable(寄認證信)功能,在production出現下面的錯誤的話

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: <p>YA~</p>
    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>
  app/views/users/mailer/confirmation_instructions.html.erb:5:in _app_views_users_mailer_confirmation_instructions_html_erb___4433493018027823975_63877720'
  app/mailers/user_mailer.rb:8:in confirmation_instructions'
  app/models/user.rb:13:in from_omniauth'
▽
  app/controllers/users/omniauth_callbacks_controller.rb:24:in facebook'

要在prodution.rb加上

config/environments/production.rb
Rails.application.routes.default_url_options[:host] = 'your_domian'

參考資料:
actionviewtemplateerror-missing-host-to-link-to-please-provide-the-host-p

comments powered by Disqus