aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-03 12:42:42 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-03 12:42:42 +0200
commitf7c711baee9ccd25fb976d45cb9fca033878fd26 (patch)
tree2d4691636f20db02780928a63602fce90012e7c1 /actionpack
parente1c16850168fbadc5ae8a0688e23170021a84955 (diff)
downloadrails-f7c711baee9ccd25fb976d45cb9fca033878fd26.tar.gz
rails-f7c711baee9ccd25fb976d45cb9fca033878fd26.tar.bz2
rails-f7c711baee9ccd25fb976d45cb9fca033878fd26.zip
No need for a regexp here.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/asset_paths.rb1
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb3
-rw-r--r--actionpack/lib/action_view/helpers/sprockets_helper.rb6
3 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_paths.rb b/actionpack/lib/action_view/helpers/asset_paths.rb
index cb6737b94e..958f0e0a10 100644
--- a/actionpack/lib/action_view/helpers/asset_paths.rb
+++ b/actionpack/lib/action_view/helpers/asset_paths.rb
@@ -21,7 +21,6 @@ module ActionView
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
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb
index 38860431b4..cd0f8c8878 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb
@@ -41,7 +41,8 @@ module ActionView
# 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)
diff --git a/actionpack/lib/action_view/helpers/sprockets_helper.rb b/actionpack/lib/action_view/helpers/sprockets_helper.rb
index b43b91178c..ab98da9624 100644
--- a/actionpack/lib/action_view/helpers/sprockets_helper.rb
+++ b/actionpack/lib/action_view/helpers/sprockets_helper.rb
@@ -40,10 +40,10 @@ module ActionView
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