【问题标题】:Actionmailer nomethoderror with delayed_job on heroku在heroku上带有delayed_job的Actionmailer nomethoderror
【发布时间】:2013-09-06 05:41:15
【问题描述】:

我正在创建一个允许用户介绍其他两个用户的网站。然后通过电子邮件通知用户已为他们创建了匹配的消息。

在本地使用延迟作业可以正常工作,但在部署到 heroku 时出现奇怪的错误:

String#notify_new_match 因 NoMethodError 失败:未定义方法 `notify_new_match' for "UserMailer":String

这是控制器代码:

UserMailer.delay.notify_new_match(current_user, match_email, params[:note])

还有邮件代码:

class UserMailer < ActionMailer::Base
  def notify_new_match(user, email, message)        
    @message = message
    mail(:to => email,
         :subject => "#{user.first_name} wants to introduce you")
  end
end

相关的宝石:

gem 'rails', "~> 3.2.0"
gem 'delayed_job_active_record'
gem 'activerecord-import'
gem 'thin'
gem 'pg'

【问题讨论】:

    标签: actionmailer delayed-job


    【解决方案1】:

    终于让它再次工作了。将此行添加到 Procfile。

    worker:  bundle exec rake jobs:work
    

    现在好像没事了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-13
      • 2016-04-17
      • 1970-01-01
      • 2016-07-15
      • 2013-01-28
      • 1970-01-01
      相关资源
      最近更新 更多