我正在使用PDFkit與rails 3.1。在過去,我能夠使用render_to_string函數並從該字符串創建一個pdf。然後我添加樣式表如下。我的問題是,我不知道如何從資產管道內訪問它們。 (這是我做到了在軌3.0)Rails 3.1資產管道與PDFKit
html_string = render_to_string(:template => "/faxes/show.html.erb", :layout => 'trade_request')
kit = PDFKit.new(html_string, :page_size => 'Letter')
kit.stylesheets << "#{Rails.root.to_s}/public/stylesheets/trade_request.css"
所以我的問題我如何通過資產pipline從我的控制器到我的CSS文件直接訪問?
我知道我可以使用帶有PDFkit的機架中間件將pdf呈現給瀏覽器,但在這種情況下,我需要將pdf發送給第三方傳真服務。
感謝您的幫助。
瑞安
可能的重複[如何引用編譯的資產從控制器在Rails 3.1?](http://stackoverflow.com/questions/7409948/how-does-one-reference-compiled-assets-from-the- controller-in-rails-3-1) –