Skip to content
Browse files

No need for a regexp here.

  • Loading branch information...
1 parent e1c1685 commit f7c711baee9ccd25fb976d45cb9fca033878fd26 @josevalim josevalim committed May 3, 2011
View
1 actionpack/lib/action_view/helpers/asset_paths.rb
@@ -21,7 +21,6 @@ def compute_public_path(source, dir, ext = nil, include_host = true)
return source if is_uri?(source)
source = rewrite_extension(source, dir, ext) if ext
- source = "/#{dir}/#{source}" unless source[0] == ?/
source = rewrite_asset_path(source, dir)
if controller && include_host
View
3 actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb
@@ -41,7 +41,8 @@ def rewrite_extension(source, dir, ext)
# Break out the asset path rewrite in case plugins wish to put the asset id
# someplace other than the query string.
- def rewrite_asset_path(source, path = nil)
+ def rewrite_asset_path(source, dir)
+ source = "/#{dir}/#{source}" unless source[0] == ?/
path = config.asset_path
if path && path.respond_to?(:call)
View
6 actionpack/lib/action_view/helpers/sprockets_helper.rb
@@ -40,10 +40,10 @@ def sprockets_asset_paths
class AssetPaths < ActionView::Helpers::AssetPaths #:nodoc:
def rewrite_asset_path(source, dir)
- if source =~ /^\/#{dir}\/(.+)/
- assets.path($1, performing_caching?, dir)
- else
+ if source[0] == ?/
source
+ else
+ assets.path(source, performing_caching?, dir)
end
end

0 comments on commit f7c711b

Please sign in to comment.
Something went wrong with that request. Please try again.