diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-27 23:46:39 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-27 23:46:39 -0700 |
commit | f07ff6b8fba58de373f20fd111ef2e7f4fe85744 (patch) | |
tree | cfe51404fb04b5eccb8a545ca30c59437f6555b3 /actionpack/lib | |
parent | 6a3eabe96b84f1df75dac79907f08d2f65dbf7d8 (diff) | |
parent | db5adf2d42d16859cde8f40e7b0b7fb41167cff4 (diff) | |
download | rails-f07ff6b8fba58de373f20fd111ef2e7f4fe85744.tar.gz rails-f07ff6b8fba58de373f20fd111ef2e7f4fe85744.tar.bz2 rails-f07ff6b8fba58de373f20fd111ef2e7f4fe85744.zip |
Merge pull request #1372 from jacott/master
Fix for relative_url_root when used with sprockets
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_paths.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb | 11 |
2 files changed, 7 insertions, 11 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 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 cd0f8c8878..2d49823412 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 @@ -85,17 +85,8 @@ module ActionView end end 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 - super(source, has_request) - end end end end -end
\ No newline at end of file +end |