jeudi 18 août 2016

How to write xls to tmp folder

I followed the railscasts tutorial on how a render an excel file (http://ift.tt/MmX2RS). We already have a lot of code on it so I'm trying to avoid rewriting by using a gem. How can I make it write to the rails /temp directory instead of letting the user download it? After it gets generated, I'll just attach it to an email and send to the user instead of letting the user wait for a long time. My problem now is how to write to the temp directory.

def mymethod
  @products = Product.order(:name)

  respond_to do |format|
    format.xls
  end
end

We are using rails 3.2.

Aucun commentaire:

Enregistrer un commentaire