【发布时间】:2009-07-29 10:43:35
【问题描述】:
有没有更好的方法通过 Paperlip 将一些字符串保存为附件作为制作 tmp 文件,将字符串放入其中,再次打开并将其保存为附件?
像这样:
def save_string data
tmp_file = "/some/path"
File.open(tmp_file,'w') do |f|
f.write(data)
end
File.open(tmp_file,'r') do |f|
ceneo_xml = f
save!
end
end
【问题讨论】: