使用rails 4.2.0.beta4。
在跑步者运行脚本时,似乎忽略了env 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
正确设置了env:
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
)