我尝试使用resque
使用PDFkit
部分页面导出render_to_string
。但是当我尝试使用protected method `render_to_string' called for #<ActionController::Base:0x5a65748 @real_format=nil>
时,我遇到了一些错误。
错误:
html = ActionController::Base.new.render_to_string(
:template => route,
:locals => locals,
:layout => layout
)
使用时:
undefined method `render_to_string' for Print:Module
和这一个:
html = render_to_string(
:template => route,
:locals => locals,
:layout => layout
)
使用时:
return_generic_pdf_kit
我打电话的方法是&#34; /lib/print.rb
&#34;并且住在kit = Print.return_generic_pdf_kit(url,
{
:print_blank_eval => evaluator_type,
:print_blank_prov => provider_type,
:print_blank_appl => applicant_type,
:form => form,
:scholarship => scholarship
},
false, 1)
,我正在从这样的resque工作者那里调用它:
{{1}}
希望有人能帮助我找到解决方案。
答案 0 :(得分:1)
你可以使用它
ac = ActionController::Base.new()
ac.render_to_string(:template => route,
:locals => locals,
:layout => layout)