hey everybody, this is unfortunately my second time typing this out since googlegroups never posted my first message. here''s my deal: working on a rails app where the user fills in some form data and then with the given info i build a pdf with pdf-writer. after the pdf generates i want to have a link created on the next page for the user to download the pdf to their local machine. few questions: where''s the best place to store the pdf in the rails tree (i imagine somewhere in public) for the user to be able to download it. also, since many users will be using this interface i need a mechanism to junk stale reports. i suppose it could be done with a cron or backgroundrb type deal where it compares the timestamp of the file and the current time and deletes the file after a certain amount of time has passed (probably have a mechanism to regen the reports anyway).. any other issues i might need to look out for? thanks in advance.. stuart (the other one) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 10/16/06, Stuart Wade <stewbawka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > hey everybody, > > this is unfortunately my second time typing this out since googlegroups > never posted my first message. > > here''s my deal: > > working on a rails app where the user fills in some form data and then > with the given info i build a pdf with pdf-writer. after the pdf generates i > want to have a link created on the next page for the user to download the > pdf to their local machine. few questions: where''s the best place to store > the pdf in the rails tree (i imagine somewhere in public) for the user to be > able to download it.It may not be a problem, but if you put the generated file into the public tree somewhere, then that file is available for anyone to download. If you store it outside your public tree you will need to serve it up with a controller action that utilises send_data also, since many users will be using this interface i need a mechanism to> junk stale reports. i suppose it could be done with a cron or backgroundrb > type deal where it compares the timestamp of the file and the current time > and deletes the file after a certain amount of time has passed (probably > have a mechanism to regen the reports anyway)..It may be possible for BackgroundDRB to look after this. If your controller passes the request to a background worker, the controller action may be able to clean up the file after download is complete. I''m not sure about this one though. Maybe someone who has a better knowledge of BackgroundDRB would be able to answer this part better. You can find BackgroundDRB at http://brainspl.at/articles/tag/drb Hope that helps --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Steve Koppelman
2006-Oct-16 16:21 UTC
Re: generating a pdf from form data and serving it back
Unless it would cause a big performance hit, you might want to think about not storing the PDFs at all. I have apps that generate CSV (for opening with a spreadhseet program) and do PDF form-filling on demand. It''s not a problem for me since those functions don''t get hit too frequently and what I''m generating isn''t more db or cpu-intensive than a typical CRUD webpage. Stuart Wade wrote:> hey everybody, > > this is unfortunately my second time typing this out since googlegroups > never posted my first message. > > here''s my deal: > > working on a rails app where the user fills in some form data and then > with > the given info i build a pdf with pdf-writer. after the pdf generates i > want > to have a link created on the next page for the user to download the pdf > to > their local machine. few questions: where''s the best place to store the > pdf > in the rails I tree (i imagine somewhere in public) for the user to be > able to > download it. also, since many users will be using this interface i need > a > mechanism to junk stale reports. i suppose it could be done with a cron > or > backgroundrb type deal where it compares the timestamp of the file and > the > current time and deletes the file after a certain amount of time has > passed > (probably have a mechanism to regen the reports anyway).. > > any other issues i might need to look out for? > > thanks in advance.. > > > stuart (the other one)-- 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 -~----------~----~----~----~------~----~------~--~---