Ruby on rails 轨道/乘客子URI错误
我正在尝试使用passenger 2.2.15将Rails 3.0.0应用程序部署到子URI 我相信我已经对我的http.conf进行了正确的Ruby on rails 轨道/乘客子URI错误,ruby-on-rails,ruby-on-rails-3,passenger,Ruby On Rails,Ruby On Rails 3,Passenger,我正在尝试使用passenger 2.2.15将Rails 3.0.0应用程序部署到子URI 我相信我已经对我的http.conf进行了正确的RailsBaseURI更改,将子URI符号链接到我的应用程序的公共目录,并将以下代码行添加到environments/production.rb: config.action_controller.relative_url_root = "/sub_uri" module ActionController class Base # Depr
RailsBaseURI
更改,将子URI符号链接到我的应用程序的公共目录,并将以下代码行添加到environments/production.rb
:
config.action_controller.relative_url_root = "/sub_uri"
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
在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='
乘客2.2.15和rails 3.0.0之间是否存在影响子URI的不兼容
非常感谢您为解决此错误提供的任何帮助。setter已贬值,在
actionpack/lib/action\u controller/railtie.rb中找不到它
如图所示(actionpack/lib/action\u controller/deferred/base.rb
):
因此,您需要设置环境变量:RAILS\u RELATIVE\u URL\u ROOT=“/sub\u uri”
来设置环境变量add:
SetEnv RAILS_RELATIVE_URL_ROOT /sub_uri
转到apache配置的VirtualHost
部分(或类似部分),然后通过重新启动apache和passenger确保正在读取该部分
cd <your_rails_project>
sudo apache2ctl graceful
touch tmp/restart
cd
苏多公寓酒店
触摸tmp/重新启动
1参数而不是预期的0的错误让我认为他们不再允许您设置相对url根。编辑:经过调查,似乎setter被贬低了,现在作为一个环境变量受到青睐:ENV['RAILS\u RELATIVE\u URL\u ROOT']这似乎与最终的rails3版本没有任何关系。为我工作。使用Rails 3.0.0和Passenger 3.0.0。谢谢
cd <your_rails_project>
sudo apache2ctl graceful
touch tmp/restart