我在从数据库导出为 XLS 时遇到了一些问题。我使用 gem to_xls,在遵循文档后,我遇到了这个错误,我不知道如何克服并启动文件的下载:
控制器:
def export
@subscribes = Subscribe.all
respond_to do |format |
format.xls { send_data@subscribes.to_xls, disposition: 'attachment', : filename = > 'Subscribes.xls' }
end
end
Run Code Online (Sandbox Code Playgroud)
我的 MIME 文件
Mime::Type.register "application/vnd.ms-excel", :xls
Run Code Online (Sandbox Code Playgroud)
因此,我在完整标头中遇到的错误:
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
Run Code Online (Sandbox Code Playgroud)
谢谢你帮助我:)
我是第一次尝试把我的rails项目放到google云引擎上,遇到了很多麻烦。我想使用自定义运行时上传我的项目app.yaml(因为我也希望 yarn 安装依赖项),但是部署命令失败并出现以下错误:
Error Response: [4] Your deployment has failed to become healthy in the allotted time and therefore was rolled back. If you believe this was an error, try adjusting the 'app_start_timeout_sec' setting in the 'readiness_check' section.
PS:应用程序在本地运行(开发和生产环境)。
我的 app.yaml 看起来像这样:
entrypoint: bundle exec rails s -b '0.0.0.0' --port $PORT
env: flex
runtime: custom
env_variables:
My Environment variables
beta_settings:
cloud_sql_instances: ekoma-app:us-central1:ekoma-db
readiness_check:
path: "/_ah/health"
check_interval_sec: 5
timeout_sec: 4
failure_threshold: 2
success_threshold: 1
app_start_timeout_sec: 120
Run Code Online (Sandbox Code Playgroud)
我的 Dockerfile 看起来像这样: …