I\'ve read a lot on rendering Rails partials and views in rake tasks / background jobs / models. The vast majority of things I have found on Stackoverflow and the web describe
Make sure you're loading the rails environment in the job. If that is already done you can try something like:
include Rails.application.routes.url_helpers