Skip to content

url helpers missing in Resque jobs #11782

@shipstar

Description

@shipstar

I'm not sure if this is a Rails issue or a Resque issue, so feel free to make me move it.

I recently upgraded from 3.2.12 to 3.2.13. I started seeing the following error message in certain Resque jobs:

In order to use #url_for, you must include routing helpers explicitly. For instance, `include Rails.application.routes.url_helpers

My Resque job is calling out to UserMailer. If I add

class UserMailer < ActionMailer::Base
  include Rails.application.routes.url_helpers

  def invitation_email
    # same error as before
    @invitation_url = invitation_url(@user.invitation_code)
  end
end

I'm still getting the same error message. The only way I can resolve it is by explicitly writing out the entire chain:

@invitation_url = Rails.application.routes.url_helpers.invitation_url(@user.invitation_code)

If I revert back to 3.2.12, the issue goes away.

I've updated to 3.2.14, and tried bumping resque versions as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions