Question

I'm creating a site that allows a user to introduce two other users. The users are then notified by email that a matching message has been created for them.

Using delayed-job works fine locally but I'm getting an odd error when deploying to heroku:

String#notify_new_match failed with NoMethodError: undefined method `notify_new_match' for "UserMailer":String

Here's the controller code:

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

And the Mailer code:

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

The relevant gems:

gem 'rails', "~> 3.2.0"
gem 'delayed_job_active_record'
gem 'activerecord-import'
gem 'thin'
gem 'pg'
Was it helpful?

Solution

Finally got it working again. Added this line to the Procfile.

worker:  bundle exec rake jobs:work

Seems to be fine now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top