title: PDFkit rails3.1 and development env
body: <p>My Rails 3.1 app is using PDFkit to render specific pages, and I'm running into (what seems like) a common problem with where trying to generate the pdf is causing the process to hang. 
  I found this solution here on stackoverflow: <a href="https://stackoverflow.com/questions/7531005/rails-3-and-pdfkit">rails 3 and PDFkit</a>.  Where I add a <code>config.threadsafe!</code> entry in my development.rb file and this works <strong>BUT</strong> it requires that for every change anywhere in the app I have to stop and restart my server to see my changes.  NOT acceptable from a workflow - I'm currently setting up the styling for the PDF pages, and it's painfully slow process having to do this.</p>
  
  <p>I also found the same issue reported here: <a href="https://github.com/jdpace/PDFKit/issues/110" rel="nofollow noreferrer">https://github.com/jdpace/PDFKit/issues/110</a>, and the issue points to this workaround: <a href="http://jguimont.com/post/2627758108/pdfkit-and-its-middleware-on-heroku" rel="nofollow noreferrer">http://jguimont.com/post/2627758108/pdfkit-and-its-middleware-on-heroku</a>.  </p>
  
  <pre><code> ActionController::Base.asset_host = Proc.new { |source, request|
    if request.env["REQUEST_PATH"].include? ".pdf"
      "file://#{Rails.root.join('public')}"
    else
      "#{request.protocol}#{request.host_with_port}"
    end
  }
  </code></pre>
  
  <p>This removes the need to restart the change, <strong>BUT</strong> now when I load the pdf it's without the styles rendered from the asset pipeline because it's taking the assets from the public directory.  I think I could work with this solution if I could know how to create the stylesheets for the pdf templates in the public folder. IS anyone developing with PDFKit and Rails3.1 where this is all working in sync?  </p>
  
  <p>Any help would be greatly appreciated!
  Thanks!
  Tony</p>