3
내 데이터베이스에서 XLS로 내보내기에 약간의 문제가 있습니다. 나는 보석 to_xls
를 사용하여 문서를 folowing 후 나는의 탐을 얻는 방법을 알고 내 파일의 다운로드가 시작되지 않는이 오류가 있습니다레일 send_data 반환 HTTP 오류 406
컨트롤러 :
def export
@subscribes = Subscribe.all
respond_to do |format |
format.xls { [email protected]_xls, disposition: 'attachment', : filename = > 'Subscribes.xls' }
end
end
내 MIME을
Request URL:https://localhost:3000/subscribes/export
Request Method:GET
Status Code:406 Not Acceptable
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Host:localhost:3000
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36
Cache-Control:no-cache
Connection:close
Content-Type:text/html; charset=utf-8
Server:thin 1.5.1 codename Straight Razor
Strict-Transport-Security:max-age=31536000
X-Request-Id:a5be7889994f1035818d6a554f991636
X-Runtime:0.012001
X-UA-Compatible:IE=Edge
:
Mime::Type.register "application/vnd.ms-excel", :xls
그래서, 나는 전체 헤더를 가지고 오류 파일 저를 도와 주셔서
감사합니다 :)
대단히 감사합니다! – Nox