我正在尝试使用 delayed_job
通过 xml 更新远程数据库
在我的 lib 文件夹中,我放了一个文件,该文件的类应该执行 render_to_text
与 template.xml.builder
,但我得到:
undefined method `render_to_string' for #<SyncJob:0x7faf4e6c0480>...
我究竟做错了什么?
最佳答案
ac = ActionController::Base.new()
ac.render_to_string(:partial => '/path/to/your/template', :locals => {:varable => somevarable})
关于ruby-on-rails - lib 类中的 render_to_string 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2678045/