rails/rails — Issue #3365: asset_path helper not including relative url when used in .css.erb
Author: pokonski
Created: 2011-10-19 11:52:01+00:00
State: open

Hi!

I'm using Rails 3.1.1 and Passenger to deploy an application to ``/community`` sub-uri. In regular views this:

<%= asset_path "image.png" %>

transforms into proper path:

/community/assets/image.png

But the same helper in my ``style.css.erb`` file produces:

/assets/image.png

Seems that asset_path in regular views comes from ``Sprockets::Helpers::RailsHelper.asset_path`` and asset_path in ``.css.erb`` fires a different function (I added a debug line to asset_path method and it only prints when called from views, not stylesheets.

I've seen a lot of older issues similar to this one, but none of them fixed this, so far.