rails 3 and PDFkit

前端 未结 2 545
南方客
南方客 2020-12-18 13:55

I\'m trying to follow this tutorial.

When I\'m adding .pdf to my url it does nothing. My controller has:

respond_to :html, :pdf.
         


        
2条回答
  •  [愿得一人]
    2020-12-18 14:13

    I found a better way to access my .pdf urls even in developpement mode.

    # Enable threaded mode
    config.threadsafe!
    
    # Code is not reloaded between requests
    #config.cache_classes = true
    

    Config.cache_classes is a comment, cause i had some problems when it wasn't. This way pdfkit works wonder even with rails 3.1. But, you don't reload code between requests.

    That's not really a problem, cause you first work on your html, and you switch configuration, in order to check the pdf result. This way you don't have to bother about your production database.

提交回复
热议问题