1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

No need for a regexp here.

This commit is contained in:
José Valim 2011-05-03 12:42:42 +02:00
parent e1c1685016
commit f7c711baee
3 changed files with 5 additions and 5 deletions

View file

@ -21,7 +21,6 @@ module ActionView
return source if is_uri?(source) return source if is_uri?(source)
source = rewrite_extension(source, dir, ext) if ext source = rewrite_extension(source, dir, ext) if ext
source = "/#{dir}/#{source}" unless source[0] == ?/
source = rewrite_asset_path(source, dir) source = rewrite_asset_path(source, dir)
if controller && include_host if controller && include_host

View file

@ -41,7 +41,8 @@ module ActionView
# Break out the asset path rewrite in case plugins wish to put the asset id # Break out the asset path rewrite in case plugins wish to put the asset id
# someplace other than the query string. # 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 path = config.asset_path
if path && path.respond_to?(:call) if path && path.respond_to?(:call)

View file

@ -40,10 +40,10 @@ module ActionView
class AssetPaths < ActionView::Helpers::AssetPaths #:nodoc: class AssetPaths < ActionView::Helpers::AssetPaths #:nodoc:
def rewrite_asset_path(source, dir) def rewrite_asset_path(source, dir)
if source =~ /^\/#{dir}\/(.+)/ if source[0] == ?/
assets.path($1, performing_caching?, dir)
else
source source
else
assets.path(source, performing_caching?, dir)
end end
end end