lib 类中的 render_to_string 不起作用 [英] render_to_string in lib class not working
本文介绍了lib 类中的 render_to_string 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 delayed_job
通过 xml 更新远程数据库
I'm trying to use delayed_job
to update a remote database via xml
在我的 lib 文件夹中,我放了一个文件,该文件的类应该使用 template.xml.builder
执行 render_to_text
,但我得到:
In my lib folder I put a file with a class that should do a render_to_text
with template.xml.builder
, but I get:
undefined method `render_to_string' for #<SyncJob:0x7faf4e6c0480>...
我做错了什么?
推荐答案
ac = ActionController::Base.new()
ac.render_to_string(:partial => '/path/to/your/template', :locals => {:varable => somevarable})
这篇关于lib 类中的 render_to_string 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文