Existe-t-il un meilleur moyen d'enregistrer une chaîne en pièce jointe via Paperlip en créant un fichier tmp, en y mettant la chaîne, en l'ouvrant à nouveau et en l'enregistrant en pièce jointe?Paperclip save attachment
Comme ceci:
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
pourquoi diable voulez-vous faire ça? – Lichtamberg