URI Rails / Passenger Error

I am trying to deploy a Rails 3.0.0 application to an additional URI using Passenger 2.2.15.

I believe that I made the correct changes RailsBaseURIto my http.conf, linked the sub-URI to the shared directory of my application, and added the following line of code to environments/production.rb:

config.action_controller.relative_url_root = "/sub_uri"

I have done this several times pre-rails3.0.0. However, the application will not start. It does not work with the following Passenger error:

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

Is there an incompatibility between passenger 2.2.15 and rails 3.0.0 that affects the sub-URI?

Any help in sorting this error is appreciated.

+3
source share
2 answers

, 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"

+6

, :

SetEnv RAILS_RELATIVE_URL_ROOT /sub_uri

VirtualHost ( ) apache , apache .

cd <your_rails_project>
sudo apache2ctl graceful
touch tmp/restart
0

Source: https://habr.com/ru/post/1762554/


All Articles