diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-10-22 23:41:11 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-10-22 23:41:11 +0000 |
commit | afd288cf8141eca321061cb00879f52108d68013 (patch) | |
tree | f23c8230880c5c012f9ef1a5b30849584221b339 /actionpack/lib | |
parent | ba5591f21240534186714efad207d3d8558ad391 (diff) | |
download | rails-afd288cf8141eca321061cb00879f52108d68013.tar.gz rails-afd288cf8141eca321061cb00879f52108d68013.tar.bz2 rails-afd288cf8141eca321061cb00879f52108d68013.zip |
Fixed that setting RAILS_ASSET_ID to "" should not add a trailing slash after assets (closes #6454) [BobSilva/chrismear]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5335 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 12 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/capture_helper.rb | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 93f04968f9..086880b06d 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -159,11 +159,13 @@ module ActionView private def compute_public_path(source, dir, ext) source = source.dup - source = "/#{dir}/#{source}" unless source.first == "/" || source.include?(":") - source << ".#{ext}" unless source.split("/").last.include?(".") - source << '?' + rails_asset_id(source) if defined?(RAILS_ROOT) && %r{^[-a-z]+://} !~ source - source = "#{@controller.request.relative_url_root}#{source}" unless %r{^[-a-z]+://} =~ source - source = ActionController::Base.asset_host + source unless source.include?(":") + source << ".#{ext}" if File.extname(source).blank? + unless source =~ %r{^[-a-z]+://} + source = "/#{dir}/#{source}" unless source[0] == ?/ + asset_id = rails_asset_id(source) + source << '?' + asset_id if defined?(RAILS_ROOT) and not asset_id.blank? + source = "#{ActionController::Base.asset_host}#{@controller.request.relative_url_root}#{source}" + end source end diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index 28b3e29967..497ce093eb 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -89,7 +89,7 @@ module ActionView # named @@content_for_#{name_of_the_content_block}@. So <tt><%= content_for('footer') %></tt> # would be avaiable as <tt><%= @content_for_footer %></tt>. The preferred notation now is # <tt><%= yield :footer %></tt>. - def content_for(name, &block) + def content_for(name, content = nil, &block) eval "@content_for_#{name} = (@content_for_#{name} || '') + capture(&block)" end |