Hello,
I solving the problem myself. I will describe my first solution.
Generation the PDF document with FPDF like this.
> pdf=FPDF.new
> pdf.AddPage
>
> pdf.XXX
The way of saving the generated PDF to the Filesystem is
pdf.Output(filename)
The challenge was creating a empty attachment_fu asset and saving the
file to this asset.
asset = Asset.new()
asset.filename = filename
asset.content_type = ''application/pdf''
asset.save
Then there is an empty asset, but nothing correspond with the
asset.public_filename. Solving this by creating the directory structure
FileUtils.mkdir_p("public"+asset.public_filename.slice(0,asset.public_filename.rindex("/")+1))
and then writing the file
pdf.Output("public"+asset.public_filename).
Note, a require ''fileutils'' is needed for using mkdir_p.
If anybody knows a more ruby-way solution, please contact me.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---