Module: ActionView::Helpers
- Defined in:
- lib/cdn_sumo_sprockets_rails2/rails2/asset_helpers.rb
Instance Method Summary collapse
- #rewrite_asset_path(source) ⇒ Object (also: #asset_path)
Instance Method Details
#rewrite_asset_path(source) ⇒ Object Also known as: asset_path
3 4 5 6 7 8 9 10 11 |
# File 'lib/cdn_sumo_sprockets_rails2/rails2/asset_helpers.rb', line 3 def rewrite_asset_path(source) source = source.gsub(/^\//, "") # remove the leading / source = source.gsub(/^images\/|^stylesheets\/|^javascripts\//, "") # remove leading images/ stylesheets/ or javascripts/ if asset = Rails.asset_pipeline.find_asset(source) File.join("/assets/", asset.digest_path) else "/#{source}" end end |