Module: ActionView::Helpers

Defined in:
lib/sprockets/rails2/asset_helpers.rb

Instance Method Summary collapse

Instance Method Details

#rewrite_asset_path(source) ⇒ Object Also known as: asset_path



3
4
5
6
7
8
9
10
# File 'lib/sprockets/rails2/asset_helpers.rb', line 3

def rewrite_asset_path(source)
  asset_path = source.gsub(%r{^/}, "") # remove the leading /
  if asset = Rails.asset_pipeline[asset_path]
    "/assets/" + asset.digest_path
  else
    source
  end
end