有没有办法将字符串转换为ActionDispatch::Http::UploadedFile
我需要它能够在 API 请求中传递文件路径来处理将 Excel 插入数据库的操作,因为我想使用 REST API 而不是浏览器来上传文件。
谢谢
我想在 Rails 4 中使用 gem Prawn 生成横向格式的 PDF 文件。我在手册中阅读了以下选项,效果很好。
pdf = Prawn::Document.new(:page_size => "A4", :page_layout => :landscape)
Run Code Online (Sandbox Code Playgroud)
但是,我想在 apps/pdfs/student_voucher_pdf.rb 中的单独控制器“StudentVoucherPdf”中编写所有渲染代码,并且我将此控制器称为:
pdf = StudentVoucherPdf.new(@student)
Run Code Online (Sandbox Code Playgroud)
现在我无法弄清楚应该在哪里给出 :page_layout => :landscape 命令。请帮忙。如果您需要了解任何其他事情,请询问。