Module: ActionView::Helpers

Defined in:
lib/asset_pipeline/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
11
# File 'lib/asset_pipeline/helpers.rb', line 3

def rewrite_asset_path(source)
  asset_path = source.gsub(%r{^/}, "") # remove the leading /
  if asset = Rails.asset_pipeline[asset_path]
    "/#{Radiant::config["asset_pipeline.path"]}/" + asset.digest_path
  else
    asset_id = rails_asset_id(source)
asset_id.blank? ? source : source + "?#{asset_id}"
  end
end