とLoadError私は上記のエラーを取得するフォームを送信すると誰かが次のRuby on Railsエラーについて説明できますか? CandidatesController#で
Unable to autoload constant
Usermailer
, expectedZ:/railsassignment/student/app/mailers/usermailer.rb
to define it
を作成します。フォームはレコードを処理し、候補者はデータベースに追加されますが、新しく登録した候補者に送信しようとしているウェルカム電子メールは送信されません。
候補コントローラ
def create
@candidate = Candidate.new(candidate_params)
respond_to do |format|
if @candidate.save
Usermailer.welcome(@candidate).deliver_now ***<-- Error highlights this line***
format.html { redirect_to @candidate, notice: 'User was successfully
created.' }
format.json { render :show, status: :created, location: @candidate }
else
format.html { render :new }
format.json { render json: @candidate.errors, status:
:unprocessable_entity }
end
end
end
usermailer.rb
Z:/railsassignment/student/app/mailers/usermailer.rb(usermailerディレクトリ)
class UserMailer < ActionMailer::Base
default from: "[email protected]"
def welcome(candidate)
@candidate = candidate
mail(:to => candidate.can_email, :subject => "Welcome to EmployeMe.com, You
have registered successfully!")
end
end
が万一それ以上のファイルを見る必要があります。私はコメントを削除して、すぐにそれらを追加します質問。
'Usermailer'!=' UserMailer' – Stefan