我需要ActiveStorage中的新函数到resize_to_fill,所以我升级到Ruby2.5.1和Rails 6。
ruby '2.5.1'
gem "rails", github: "rails/rails"当我停止时,然后重新启动服务器(Cloud9),我收到了以下Rails错误:
Blocked host: xxxxxxx-xxxxxxx.c9users.io
To allow requests to xxxxxxx-xxxxxxx.c9users.io, add the following configuration:
Rails.application.config.hosts << "xxxxxxx-xxxxxxx.c9users.io"我试过重新启动,新的窗户,但什么都没有用。我以前从没见过这样的错误。我猜新版本的Rails正在做些什么?
发布于 2020-04-14 22:26:32
我将Rails.application.config.hosts << "xxxxxxx-xxxxxxx.c9users.io"添加到config/application.rb中,它很好地修复了我的测试应用程序。然后我对我真正的应用程序做了这件事,它也成功了。问题是,设计抛出了一个错误,这显然不会被修复,至少要到Rails 6测试版。我想我将回到Carrierwave,以满足图像大小的需要,直到ActiveStorage更加成熟。
发布于 2019-07-17 06:29:05
阻塞主机是Rails 6的一个新特性。
config.hosts << /[a-z0-9]+\.c9users\.io/对于ngrok用户,只需将上面的c9users替换为ngrok
更新: ngrok当前在URL中使用-和.作为子域,所以这应该是精确的config.hosts << /[a-z0-9-.]+\.ngrok\.io/
发布于 2019-05-21 12:35:16
如果要在开发环境中禁用此功能,可以将config.hosts.clear添加到config/environments/development.rb中。
https://stackoverflow.com/questions/53878453
复制相似问题