2016-09-20 2 views
0

저는 RoR의 초보자이며 Michael Hartl의 Ruby on Rails 샘플 애플리케이션 자습서를 따르고 있습니다. Whist 10 장과 11 장을 완료하면 문제를 해결할 방법을 알 수 없습니다.M.Hartl의 Ruby on Rail, 10/11 (활성화/비밀번호 재설정) 오류

내 테스트는 모두 정상적으로 통과하지만 앱이 Heroku.com을 통해 라이브를 사용할 때 앱에서 자동 활성화 및 비밀번호 재설정 이메일을 전송하지만 사용자가이 이메일의 링크를 클릭하면 웹 브라우저가 ' 제목없는 : 빈 페이지.

아무도 내가 이것을 해결할 수있는 방법을 알고 있습니다. 아래의 관련 코드 중 일부를보고 더 이상 볼 필요가있는 경우 알려주십시오.

도움이 될 것입니다.

많은 감사

1 Rails.application.routes.draw do 
2 root 'static_pages#home' 
3 get '/help', to: 'static_pages#help' 
4 get '/about', to: 'static_pages#about' 
5 get '/contact', to: 'static_pages#contact' 
6 get '/signup', to: 'users#new' 
7 get '/login', to: 'sessions#new' 
8 post '/login', to: 'sessions#create' 
9 delete '/logout', to: 'sessions#destroy' 
10 resources :users 
11 resources :account_activations, only: [:edit] 
12 resources :password_resets, only: [:new, :create, :edit, :update] 
13 end 

user_mailer/password_reset.html.erb =

1 <h1>Password reset</h1> 
2 <p>To reset you password click the link below:</p> 
3 
4 <%= link_to "Reset password", edit_password_reset_url(@user.reset_token, 
5              email: @user.email) %> 
6 
7 <p> This link will expire in two hours.</p> 
8 
9 <p> 
10 If you did not request your password to be reset, please ignore this email and your password will remain unchanged. 
11 </p> 

user_mailer/password_reset =

페이 매튜스

routes.rb (선불). text.erb =

,451,515,
1 To reset you password click the link below: 
2 
3 <%= edit_password_reset_url(@user.reset_token, email: @user.email) %> 
4 
5 This link will expire in two hours. 
6 
7 If you did not request you password to be reset, please ignore this email and your password will remain unchanged. 

환경/production.rb =

60 config.action_mailer.raise_delivery_errors = true 
61 config.action_mailer.delivery_method = :smtp 
62 config.action_mailer.default_url_options = { :host => '<safe-falls-22225>.herokuapp.com' } 
63 ActionMailer::Base.smtp_settings = { 
64  :address    => 'smtp.sendgrid.net', 
65  :port     => '587', 
66  :authentication   => :plain, 
67  :user_name   => ENV['SENDGRID_USERNAME'], 
68  :password    => ENV['SENDGRID_PASSWORD'], 
69  :domain    => 'heroku.com', 
70  :enable_starttls_auto => true 
71 } 
+0

에 오타가이가 <안전은-폭포-22225을>는 이름 너의 영웅 녀석? – JGutierrezC

답변

0

config/environments/production.rb

config.action_mailer.default_url_options = { host: 'safe-falls-22225.herokuapp.com' } 

의 변화 line:62 당신이 당신의 default_url_options

+0

고맙습니다. 문제가 해결되었습니다. :) –

관련 문제