Search code examples
ruby-on-railsjrubywarbler

How to point image-path scss helper to relative URL


My app's production instance is running on relative URL: http://server/app_domain/

image-path scss helper is pointing to /assets/image1234.png which resolves into

http://server/assets/image1234.png

instead of

http://server/app_domain/assets/image1234.png

Is there any configuration to setup the root url for the application? I would expect the image-path to generate ../assets/image1234.png or /app_domain/assets/image1234.png

I am using JRuby/warbler/JBoss for prod/uat deployment.

Thank you


Solution

  • In config/environments/production.rb you can set the asset host that is being used in all asset helpers.

    config.action_controller.asset_host = "http://server/app_domain/"
    

    This will give you absolute urls but the way you need it.