rsw*_*lff 3 ruby-on-rails passenger ruby-on-rails-3
我正在尝试使用乘客2.2.15将Rails 3.0.0应用程序部署到子URI.
我相信我已经RailsBaseURI
对我的http.conf 进行了正确的更改,将子URI符号链接到我的应用程序的公共目录,并将以下代码行添加到environments/production.rb
:
config.action_controller.relative_url_root = "/sub_uri"
Run Code Online (Sandbox Code Playgroud)
我在rails3.0.0之前做了好几次.也就是说,该应用程序将无法启动.它失败并出现以下乘客错误:
Error Message: wrong number of arguments(1 for 0)
Exception class: ArgumentError
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.0/lib/action_controller/railtie.rb 54 in `relative_url_root='
Run Code Online (Sandbox Code Playgroud)
乘客2.2.15和rails 3.0.0之间是否存在影响子URI的不兼容性?
非常感谢任何帮助整理此错误.
这个二传手是折旧的,无处可寻actionpack/lib/action_controller/railtie.rb
.
如此处所示(actionpack/lib/action_controller/depreciated/base.rb
):
module ActionController
class Base
# Deprecated methods. Wrap them in a module so they can be overwritten by plugins
# (like the verify method.)
module DeprecatedBehavior #:nodoc:
def relative_url_root
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root is ineffective. " <<
"Please stop using it.", caller
end
def relative_url_root=
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root= is ineffective. " <<
"Please stop using it.", caller
end
end
end
end
Run Code Online (Sandbox Code Playgroud)
在actionpack/lib/action_controller/metal/compatibility.rb
你可以看到它的setter是一个ENV
变量:
self.config.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT']
Run Code Online (Sandbox Code Playgroud)
所以你需要设置ENV变量: RAILS_RELATIVE_URL_ROOT="/sub_uri"