新手问题 ruby send_data 问题

shlallen · April 30, 2013 · Last by shlallen replied at April 30, 2013 · 3372 hits

send_data 方法只能在 rails 中使用么?如果我是在单个 ruby 文件中调用该方法的话,会报错:undefined method `send_data' for main:Object (NoMethodError)

我只是想希望将一对数据存入一个 pdf 文件: send_data response, :filename => "report.pdf"

请教大神该如何操作哈

send_data 完全没联系吧。就是基本的文件读写

File.open 'report.pdf', 'wb' do |f|
  f << response
end

#1 楼 @luikore 好吧,原来基本的文件读写就能完成,谢谢哈

You need to Sign in before reply, if you don't have an account, please Sign up first.