2014-11-25 126 views
0

使用rails 4.2.0.beta4。rails runner忽略子目录RAILS_RELATIVE_URL_ROOT

看起来env RAILS_RELATIVE_URL_ROOT在运行runner脚本时被忽略。它不工作时使用我的网络服务器。但与亚军我得到这个:

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

对于我的网络服务器(麒麟BTW)它的工作原理是用下面的config.ru启动它(这是不使用亚军据我所知):

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

回答