gpt4 book ai didi

ruby-on-rails - Rails/Passenger 子 URI 错误

转载 作者:行者123 更新时间:2023-12-04 06:17:50 26 4
gpt4 key购买 nike

我正在尝试使用 passenger 2.2.15 将 Rails 3.0.0 应用程序部署到子 URI。

我相信我已经对我的 http.conf 进行了正确的 RailsBaseURI 更改,已将子 URI 符号链接(symbolic link)到我的应用程序的公共(public)目录,并将以下代码行添加到 environments/production.rb:

config.action_controller.relative_url_root = "/sub_uri"

我在 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='

passenger 2.2.15 和 rails 3.0.0 之间是否存在影响子 URI 的不兼容性?

非常感谢任何解决此错误的帮助。

最佳答案

setter 已贬值,在 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

actionpack/lib/action_controller/metal/compatibility.rb 中你可以看到它的 setter 是一个 ENV 变量:

self.config.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT']

所以需要设置ENV变量:RAILS_RELATIVE_URL_ROOT="/sub_uri"

关于ruby-on-rails - Rails/Passenger 子 URI 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3613873/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com