我是RoR的新手,並且遵循Michael Hartl的Ruby on Rails示例應用教程。 Whist完成第10章和第11章已經遇到並且問題我不確定如何解決。M.Hartl在第10/11章(激活/密碼重置)上的Ruby on Rail錯誤
我所有的測試都通過,但當通過Heroku.com直播使用應用程序時,應用程序將發送自動激活和密碼重置電子郵件,但是當用戶點擊這些電子郵件中的鏈接時,無標題:空白'頁面。
有誰知道我該如何解決這個問題。請參閱下面的一些相關代碼,並讓我知道你是否需要再看。
任何幫助將不勝感激。
非常感謝(事先)
菲馬修斯
的routes.rb =
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。 text.erb =
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 }
是這個<安全-下降-22225>名你的herokuapp? – JGutierrezC