【问题标题】:rails runner ignored subdirectory RAILS_RELATIVE_URL_ROOTrails runner 忽略了子目录 RAILS_RELATIVE_URL_ROOT
【发布时间】:2015-01-23 07:55:51
【问题描述】:

使用 rails 4.2.0.beta4。

在运行程序运行脚本时,环境 RAILS_RELATIVE_URL_ROOT 似乎被忽略了。不使用跑步者时,它适用于我的网络服务器。但是有了跑步者,我得到了这个:

RAILS_RELATIVE_URL_ROOT=/somewhere ./bin/rails runner "puts Rails.application.routes.url_helpers.branches_path"
=> /branches # should be /somewhere/branches

环境设置正确:

RAILS_RELATIVE_URL_ROOT=/somewhere ./bin/rails runner "puts ENV['RAILS_RELATIVE_URL_ROOT']"
=> /somewhere

我也尝试在配置中设置它,但没有成功:

config.action_controller.relative_url_root = '/somewhere'
config.relative_url_root = '/somewhere'

如何让跑步者尊重子目录/RAILS_RELATIVE_URL_ROOT

对于我的网络服务器(顺便说一句,独角兽),它通过以下 config.ru(跑步者 afaik 不使用)启动它来工作:

run Rack::URLMap.new(
      ENV['RAILS_RELATIVE_URL_ROOT'] => Rails.application
)

【问题讨论】:

    标签: ruby-on-rails relative-path runner


    【解决方案1】:

    这是一个已知的 Rails 错误,希望很快得到修复:https://github.com/rails/rails/pull/17724

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-12
      • 2020-04-25
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 2018-08-10
      • 1970-01-01
      相关资源
      最近更新 更多