我一直在 localhost:3000 上测试我的 Rails 应用程序,它工作得很好。但是,当部署到我的主机时,根 URL 是:
我目前没有域名。
当我将浏览器指向上述 URL 时,我得到找不到根:
/~用户名
替代
http://99.88.77.66/~username/controller/index
我找不到这条路线:
/~用户名/ Controller /索引
我正在使用 Rials 4.2.3 和 Ruby 2.0。
在获得合适的域名之前,如何使我的路由与此类子文件夹一起工作?
最佳答案
尝试在 config/environments/production.rb
中设置 config.relative_url_root
:
http://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root
关于ruby-on-rails-4 - 在子文件夹下运行 rails app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31883197/