aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/asset_paths.rb
diff options
context:
space:
mode:
authorjacott <geoffjacobsen@gmail.com>2011-05-28 18:19:11 +1200
committerjacott <geoffjacobsen@gmail.com>2011-05-28 18:19:11 +1200
commitdb5adf2d42d16859cde8f40e7b0b7fb41167cff4 (patch)
tree2a26a8a8f106daf91d70fc30ddbee16ec8e59475 /actionpack/lib/action_view/helpers/asset_paths.rb
parentb7baf1211f83f7dd008f156f1f5cfc62b52bf458 (diff)
downloadrails-db5adf2d42d16859cde8f40e7b0b7fb41167cff4.tar.gz
rails-db5adf2d42d16859cde8f40e7b0b7fb41167cff4.tar.bz2
rails-db5adf2d42d16859cde8f40e7b0b7fb41167cff4.zip
fixed asset_paths when called from sprockets for relative_url_root
Diffstat (limited to 'actionpack/lib/action_view/helpers/asset_paths.rb')
-rw-r--r--actionpack/lib/action_view/helpers/asset_paths.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_paths.rb b/actionpack/lib/action_view/helpers/asset_paths.rb
index 1bc5c9e003..9a99c3cf52 100644
--- a/actionpack/lib/action_view/helpers/asset_paths.rb
+++ b/actionpack/lib/action_view/helpers/asset_paths.rb
@@ -44,7 +44,12 @@ module ActionView
raise NotImplementedError
end
+ def rewrite_relative_url_root(source, relative_url_root)
+ relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source
+ end
+
def rewrite_host_and_protocol(source, has_request)
+ source = rewrite_relative_url_root(source, controller.config.relative_url_root) if has_request
host = compute_asset_host(source)
if has_request && host && !is_uri?(host)
host = "#{controller.request.protocol}#{host}"
@@ -75,4 +80,4 @@ module ActionView
end
end
-end \ No newline at end of file
+end