中的纸卷列
我用:
创建一个XML文件 xml_device_path = "#{xml_device_description.get_file_path_without_name}#{title}.xml"
File.open("#{xml_device_path}", 'w') do |f|
f.puts(content.to_xml)
end
通过PaperClip将此文件连接到我的型号。
file = File.open("#{xml_device_path}")
xml_device_description.xml = file
file.close
结果文件具有内容类型" application/xml",但我需要内容类型" text/xml"。
是否可以设置或操纵文件的内容类型或在文件创建期间?
非常感谢。
我解决了问题:
#change paperclip file content type
xml_device_description.xml.xml_content_type = "text/xml"
#save activeRecord
xml_description.save!
我只是将新的内容类型设置为DB ...