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:
parent
e1c1685016
commit
f7c711baee
3 changed files with 5 additions and 5 deletions
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue