我正在使用 Spree,并设置 spree_easy_contact 扩展。
当我发送电子邮件时,它会正确发送,并将其正确保存到数据库中,但我被重定向到错误屏幕:
NoMethodError in ContactsController#create
undefined method `error' for true:TrueClass
它没有给出任何关于这可能是错误的提示。有谁知道这个错误是由什么引起的?
这是我日志中唯一剩下的内容:
NoMethodError (undefined method `error' for true:TrueClass):
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.7ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (4980.8ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (5123.9ms)
这是来自 Gem 的 contact_controller :
def create
@contact = Contact.new(params[:contact] || {})
respond_to do |format|
if @contact.valid? && @contact.save
ContactMailer.message_email(@contact).deliver
format.html { redirect_to(root_path, :notice => t("message_sended")) }
else
format.html { render :action => "new" }
end
end
end