안녕하세요이 가이드 다음 연락처 양식을 구현하기 위해 노력하고 있어요 : 내가 구글 애플 리케이션 있지만 따라 1and1의 SMTP를 사용하고 있지 않다 Contact form in Rails 3문의 양식 초기화되지 않은 상수 contactcontroller
합니다.
내가 양식을 전송하려고 할 때 내가 오류가
Processing by ContactController#create as HTML
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"N48ORAhmDqTO7X2wsRlslMJ3l+v=", "message"=>{"name"=>"Patrick", "email"=>"[email protected]", "subject"=>"Hello", "body"=>"Hello ME"}, "commit"=>"Send"}
NameError (uninitialized constant ContactController::NotificationsMailer):
app/controllers/contact_controller.rb:11:in `create'
이 미세 조정에 몇 가지 시도 후, 난 그냥 복사하고 가이드의 코드를 붙여 결국입니다. 여전히 문제가 있습니다.
class ContactController < ApplicationController
def new
@message = Message.new
end
def create
@message = Message.new(params[:message])
if @message.valid?
NotificationsMailer.new_message(@message).deliver
redirect_to(root_path, :notice => "Message was successfully sent.")
else
flash.now.alert = "Please fill all fields."
render :new
end
end
end
NotificationMailer 당신은 notification_mailer.rb
이
class NotificationMailer < ActionMailer::Base
default from: "[email protected]"
default to: "[email protected]"
def new_message(message)
@message = message
mail(subject: "[misawahousing.com] #{message.subject}")
end
end
서버를 다시 시작 했습니까? –
컨트롤러 동작 코드를 붙여 주실 수 있습니까? –
@ Michael Szyndel 편집 된 질문 – Patrick