Rendering partials / view in a rake task / background job / model in Rails 4

后端 未结 2 557
终归单人心
终归单人心 2021-02-01 17:24

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

2条回答
  •  隐瞒了意图╮
    2021-02-01 18:10

    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
    

提交回复
热议问题