A391f932c5bb61131c99f8543a07f697

Is there a better way to save some string as an attachment via Paperclip as making a tmp file, putting the string into it, opening it again and saving it as an attachment ?

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

Refactorings

No refactoring yet !

Your refactoring





Format Copy from initial code

or Cancel