title: JRuby Rails 3.1.6 deploy WAR on Tomcat 7 in subdirectory (redirects and links don't use the subdirectory)
body: <p>I have an JRuby on Rails 3.1.6 application and want to deploy it on a Tomcat 7 as WAR file. To generate the war I use warbler.</p>
  
  <p>I can deploy the application to the server and all is running. But the links generated or a redirect form devise to <code>/users/sign_in</code> dont work because the context path is ignored.</p>
  
  <p>I tried to set the relative url root with:</p>
  
  <pre><code>config.action_controller.relative_url_root = '/foo'
  </code></pre>
  
  <p>But the method was not found. (Also tried the ENV variable for this, but nothing happened)</p>
  
  <p>I tried to use <code>scope '/foo'</code> in my <code>routes.rb</code> but this doesn't work either.</p>
  
  <p>I also tried to add this in my <code>config.ru</code></p>
  
  <pre><code>map '/foo' do
    run Foo::Application
  end 
  </code></pre>
  
  <p>But the <code>config.ru</code> files seams not to be included in the WAR file or used in any way.</p>
  
  <p><br />
  I can't generate a VirtualHost or anything in tomcat, I have only the rights to deploy the application as WAR file. Is there any way to tell the rails application that it runs under a given subdirectory (context path) so it adds this to all generated links, redirects, etc., that works within Rails 3.1.6?</p>