パスワードをリセットするためにユーザーに電子メールを送信しようとすると、実行タイムアウト エラーが発生し続けます。他のメーラー機能は動作するので、構成設定が正しいことはわかっています。ヘッダーは次のとおりです。「Timeout::Error in Password resetsController#create」
password_resets_controller は次のとおりです。
def create
@user = User.find_by_email(params[:email])
if @user
User.deliver_password_reset_instructions(@user.id)
flash[:notice] = "Instructions to reset your password have been emailed to you. " +
"Please check your email."
redirect_to '/'
else
flash[:notice] = "No user was found with that email address"
render :action => :new
end
end
User.rb内のメソッドは次のとおりです
def self.deliver_password_reset_instructions(user_id)
user = User.find(user_id)
user.reset_perishable_token!
Emailer.deliver_password_reset_instructions(user)
end
最後に、emailer.rb 内の実際のメソッドを次に示します。
default_url_options[:host] = "http://0.0.0.0:3000" #development
def password_reset_instructions(user)
@subject = "Application Password Reset"
@from = 'Notice@myApp.com'
@recipients = user.email
@sent_on = Time.now
@body["edit_password_reset_url"] = edit_password_reset_url(user.perishable_token)
@headers["X-SMTPAPI"] = "{\"category\" : \"Password Recovery\"}"#send grid category header
end
エラー メッセージの「Password」が原因で timeout::error と呼ばれるのはなぜですか