当新用户注册我的网站时,它会回来
很抱歉,出了点问题。
但是,如果您随后使用同一用户登录,则可以使用。我认为我的注册页面设置有问题,但是我似乎无法弄清为什么它不起作用。
我运行了heroku日志,这些是我得到的错误。
Error in 186ms (ActiveRecord: 6.4ms)
2018-12-24T20:39:15.626963+00:00 app[web.1]: F, [2018-12-24T20:39:15.626869 #4] FATAL -- : [3aaa57fe-9a15-468b-9371-313e8153d9bc]
2018-12-24T20:39:15.627057+00:00 app[web.1]: F, [2018-12-24T20:39:15.626998 #4] FATAL -- : [3aaa57fe-9a15-468b-9371-313e8153d9bc] ActionView::MissingTemplate (Missing template user_mailer/welcome with "mailer". Searched in:
2018-12-24T20:39:15.627061+00:00 app[web.1]: * "user_mailer"
2018-12-24T20:39:15.627063+00:00 app[web.1]: ):
2018-12-24T20:39:15.627143+00:00 app[web.1]: F, [2018-12-24T20:39:15.627089 #4] FATAL -- : [3aaa57fe-9a15-468b-9371-313e8153d9bc]
2018-12-24T20:39:15.627246+00:00 app[web.1]: F, [2018-12-24T20:39:15.627182 #4] FATAL -- : [3aaa57fe-9a15-468b-9371-313e8153d9bc] app/mailers/user_mailer.rb:13:in `welcome'
2018-12-24T20:39:15.627249+00:00 app[web.1]: [3aaa57fe-9a15-468b-9371-313e8153d9bc] app/controllers/user.registrations.controller.rb:5:in `create'
2018-12-24T20:39:15.627862+00:00 heroku[router]: at=info method=POST path="/users" host=building-together.herokuapp.com request_id=3aaa57fe-9a15-468b-9371-313e8153d9bc fwd="75.187.204.211" dyno=web.1 connect=0ms service=191ms status=500 bytes=1827 protocol=https
第一个代码是user.mailer.rb:13 FATAL
class UserMailer < ApplicationMailer
default from: "from@example.com"
def contact_form(email, name, message)
@message = message
mail(from: email,
to: 'hostetlerp@gmail.com',
subject: "A new contact form message from #{name}")
end
def welcome(user)
@appname = "Bike Shop"
mail(to: user.email, (This is the line 13 FATAL)
subject: "Welcome to #{@appname}!")
end
def thank_you
@name = params[:name]
@email = params[:email]
@message = params[:message]
UserMailer.contact_form(@email, @name, @message).deliver_now
end
end
这是第二个致命用户。registrations.controller.rb:5
class UserRegistrationsController < Devise::RegistrationsController
def create
super
if @user.persisted?
UserMailer.welcome(@user).deliever_now (This is the line 5 FATAL)
end
end
end
我似乎无法弄清楚我在这里想念的是什么。在该课程的代码中,它们看起来都一样,但是该页面无法正常工作。
请帮助