Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7042975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:13:52+00:00 2026-05-28T02:13:52+00:00

I have a Rails 3.1 application. I am deploying it via passenger to a

  • 0

I have a Rails 3.1 application.

I am deploying it via passenger to a SubURI, not to URI root. For instance, the app root is actually accessed as http://somewhere.com/application .

I have a stylesheet.css.erb in my app using the asset pipeline, that sets a background-image with

<%= asset_path 'something.gif' %>

However, when I run rake assets:precompile, it precompiles this to /assets/something.gif, not /application/assets/something.gif — because when I’m running the rake task from the command line, it doesn’t yet know about the path prefix (“/application”) that’s going to be operative when running under Passenger at a SubURI.

What’s the right way to handle this? Is there a way to tell the assets:precompile task to use a particular path prefix, because we know when precompiling that we’re actually going to deploy to a path prefix?

  • note: The path’s generated by the actual live app, for instance stylesheet_link_tag 'application' in the layout, do generate properly with the path prefix. So the asset pipeline does respect the path prefix when it’s operative. The problem is clearly that when I run assets:precompile, it’s got no way of knowing what the ultimate prefix is going to be, the way I’m running it. How do I tell it?)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:13:53+00:00Added an answer on May 28, 2026 at 2:13 am

    This has come up before:
    Seems to be a limitation in Sprockets that is now merged into master:
    https://github.com/rails/rails/pull/2977

    I guess you need to set the RAILS_RELATIVE_URL_ROOT

    Sources:

    • Broken precompiled assets in Rails 3.1 when deploying to a sub-URI
    • Rails 3.1 SASS asset helpers not not including RAILS_RELATIVE_URL_ROOT / relative_url_root
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When deploying Rails via Passenger or Mongrel you have multiple instances of the application
I have a rails app that I am deploying via capistrano. The app deploys
I currently have hostingrails.com. But following their tutorial on deploying rails application with FASTCGI
I have a rails application and i keep getting this error /srv/projects/app/controllers/application_controller.rb:174: invalid multibyte
I have had lots of trouble with deploying my rails 3.0.10 application to Ubuntu
I have been working towards deploying my rails application, and while there have been
I have Rails application with mounted Engine. #{main_app}/config/routes.rb mount CommentIt::Engine => /talk, :as =>
I have rails application running in linode server .Some guy is continuously spamming (writing
I have a Rails application that accepts file uploads of CSV files. When developing
I have a rails application that about 3 years old, and I'm having a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.