我正在升级 rails 2.3.2 app ot rails 3。在 MailerFormError 中发送电子邮件时出现未知错误。MailerFormError 是我的模型: class MailerFormError < ActionMailer::Base
在第一次我有'deliver_send'方法错误(未定义方法'deliver_sent' for MailerFormError:Class),我将其更改为'send'。现在我有这个:
NoMethodError in LeadsController#create
undefined method `part' for #
我在控制器中的代码:
@msg = {}
@msg["errors"] = @lead.errors
@msg["params"] = params
#MailerFormError.deliver_sent(@msg)
MailerFormError.sent(@msg)
这是我的发送方法类:
def sent(msg, sent_at = Time.now)
@subject = ("Ошибка при заполнении формы").force_encoding('iso-8859-1').encode('utf-8')
@recipients = 'mymail@gmail.com'
@from = 'mymail@gmail.com'
@sent_on = sent_at
@headers = {}
part( :content_type => "multipart/alternative" ) do |p|
p.part :content_type => "text/plain",
:body => render_message("sent.plain.erb", :msg=>msg )
end
end