开发者

How to save the prawn pdf on rails root without rendering

Here my code rendering pdf is ok .But I don't want render directly save to the rails folder how?

Help me please

respond_to do |format|
  format.html   # show.html.erb
  format.xml    { render :xml =>开发者_如何学JAVA @claim }
  format.report { render_report }
  format.xls    { render_report }
  format.pdf    { render :layout => false }
end


I'm not sure if I understood well... if you want to have downloadable pdf, you could do something like this:

format.pdf {send_data your_pdf, :type => 'application/pdf'}

You didn't say which version of rails are you using, but in general methods send_data and send_file could be usefull for you (links are to v 2.3.8, but of course those methods exist in newer versions).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜