【发布时间】:2015-08-11 13:49:16
【问题描述】:
我正在尝试使用PDFkit 导出resque 某些页面。但是当我尝试使用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”并位于/lib/print.rb,我是从这样一个 resque 工作者那里调用它的:
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)
希望有人能帮我找到解决办法。
【问题讨论】:
标签: ruby-on-rails ruby resque ruby-on-rails-2 pdfkit