Blob to file

Hi everyone,

I have a bunch of pdf files stored in a database (blob field) and now i
am asked to “transform” them into file system.
Is there any way to do that;
I tried something along the lines of
FileObject.find(:all).each do |fo|
f ="#{}" + “.pdf”, “w”)
f << fo.file_field
f = nil

The files get created but when i try to open the newly pdf file created
they are blank (just blank pages in each doc)

Any ideas on this; any input is appreciated.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs