0
我試圖通過控制器方法顯示使用由send_file
class DocumentsController < ApplicationController
def show
response.headers['X-Sendfile-Type'] = "X-Sendfile"
send_file(@document.file.path, filename: @document.file.name, type: "application/pdf", disposition: :inline)
end
end
這個本地工作精細顯示上傳PDF文件PDF,但在Heroku我得到的隱性應用程序錯誤,沒有進一步的堆棧跟蹤
at=info method=GET path="/documents/21" host=myapp.herokuapp.com request_id=754f6d15-cb06-43a1-aa3c-308e5308b54e fwd="76.21.40.212" dyno=web.1 connect=29ms service=27ms status=500 bytes=1543
我已經嘗試在config/environments/production.rb中設置config.action_dispatch.x_sendfile_header = "X-Sendfile"
,但這會導致應用程序上的所有資產都無法在生產環境中加載。
我錯過了什麼?
夠公平的。有沒有辦法在heroku上顯示文件? – 2014-09-23 06:25:11