diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-08 16:39:06 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-08 16:39:06 +0000 |
commit | 3c3d936f4d026336479c5ea0e953b8dcc823fbbd (patch) | |
tree | 078c7e080e747da18e2ddf3933d5d13297d1489e | |
parent | e6428abd23f8449900e174066a3acdd8ddcb7f03 (diff) | |
download | rails-3c3d936f4d026336479c5ea0e953b8dcc823fbbd.tar.gz rails-3c3d936f4d026336479c5ea0e953b8dcc823fbbd.tar.bz2 rails-3c3d936f4d026336479c5ea0e953b8dcc823fbbd.zip |
Fixed all AssetHelper methods to work with relative paths, such that javascript_include_tag('stdlib/standard') will look in /javascripts/stdlib/standard instead of '/stdlib/standard/' #1963
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2156 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index b55bd14f20..c46ed35f42 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed all AssetHelper methods to work with relative paths, such that javascript_include_tag('stdlib/standard') will look in /javascripts/stdlib/standard instead of '/stdlib/standard/' #1963 + * Avoid extending view instance with helper modules each request. Closes #1979 * Performance improvements to CGI methods. Closes #1980 [Skaes] diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index cd56592300..fea7abe3f9 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -119,7 +119,7 @@ module ActionView private def compute_public_path(source, dir, ext) - source = "/#{dir}/#{source}" unless source.include?("/") + source = "/#{dir}/#{source}" unless source.first == "/" || source.include?(":") source = "#{source}.#{ext}" unless source.include?(".") source = "#{@request.relative_url_root}#{source}" unless %r{^[-a-z]+://} =~ source ActionController::Base.asset_host + source diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 045c4b1060..84c273a72f 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -37,6 +37,7 @@ class AssetTagHelperTest < Test::Unit::TestCase JavascriptPathToTag = { %(javascript_path("xmlhr")) => %(/javascripts/xmlhr.js), + %(javascript_path("super/xmlhr")) => %(/javascripts/super/xmlhr.js) } JavascriptIncludeToTag = { |