views:

162

answers:

1

I am attempting to deploy a rails 3.0.0 application to a sub URI using passenger 2.2.15.

I believe I've made the correct RailsBaseURI changes to my http.conf , have symlinked the sub URI to the public directory of my app and added the following line of code to environments/production.rb:

config.action_controller.relative_url_root = "/sub_uri"

I've done this several times pre-rails3.0.0. That said, the app wont launch. It fails 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 sub_URI's?

Any help sorting out this error is greatly appreciated.

+1  A: 

The setter is depreciated, it's nowhere to be found in actionpack/lib/action_controller/railtie.rb.

As seen here (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

In actionpack/lib/action_controller/metal/compatibility.rb you can see it's setter is an ENV variable:

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

So you need to set the ENV variable: RAILS_RELATIVE_URL_ROOT="/sub_uri"

Garrett
This doesn't seem to do anything with the final rails3 release.
raidfive
Worked for me. Using Rails 3.0.0 and Passenger 3.0.0. Thanks.
Jim