Serving autogenerated files to users

hi everybody,

my rails app generates a pdf specially made for a user after they
finish filling out a set of online forms. i used pdf-writer to generate
the pdf on the fly which works quite nicely.

my question:
where should i generate the files to if i want the user to be able to
download them after they generate? anywhere in the public folder? also,
what is the ‘default’ path? public? so if make a hyperlink that has
href="/pdfs/cust1.pdf" would that point to RAILS_ROOT +
‘/public/pdfs/cust1.pdf’ ???

anything else i need to look out for? also, i don’t plan on keeping
these pdfs on the server forever… whats a good way to check if they’re
stale and delete them if necessary? i think we are hosting this
ourselves so it could be a crontab.

thanks in advance,

Stuart (the other stuart)

where should i generate the files to if i want the user to be able to
download them after they generate? anywhere in the public folder? also,
what is the ‘default’ path? public? so if make a hyperlink that has
href="/pdfs/cust1.pdf" would that point to RAILS_ROOT +
‘/public/pdfs/cust1.pdf’ ???

I’d use the send_file method in a controller action to allow the user to
download it. Then it doesn’t matter where you store the file, as long as
your application can access it.

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