aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/sprockets/helpers/rails_helper.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-12-06 05:16:24 -0800
committerSantiago Pastorino <santiago@wyeworks.com>2011-12-06 05:16:24 -0800
commite58d663f3e285f22f2ca249cfc28d3b5673c5708 (patch)
tree974360404c983db30f10fc45fc942e6925a56ac7 /actionpack/lib/sprockets/helpers/rails_helper.rb
parentf0f0e59c104ebd79ce2a48d5678d6a51a5acd42b (diff)
parent25007ad3fb3eac28a5f7ad3f6cd26eb33e14b4e0 (diff)
downloadrails-e58d663f3e285f22f2ca249cfc28d3b5673c5708.tar.gz
rails-e58d663f3e285f22f2ca249cfc28d3b5673c5708.tar.bz2
rails-e58d663f3e285f22f2ca249cfc28d3b5673c5708.zip
Merge pull request #3428 from adrianpike/asset_path_conflicts
Issue #3427 - asset_path_conflicts
Diffstat (limited to 'actionpack/lib/sprockets/helpers/rails_helper.rb')
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index 1ebe7f68f7..75ba1e66c2 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -26,10 +26,10 @@ module Sprockets
sources.collect do |source|
if debug && asset = asset_paths.asset_for(source, 'js')
asset.to_a.map { |dep|
- super(dep.to_s, { :src => asset_path(dep, :ext => 'js', :body => true, :digest => digest) }.merge!(options))
+ super(dep.to_s, { :src => path_to_asset(dep, :ext => 'js', :body => true, :digest => digest) }.merge!(options))
}
else
- super(source.to_s, { :src => asset_path(source, :ext => 'js', :body => body, :digest => digest) }.merge!(options))
+ super(source.to_s, { :src => path_to_asset(source, :ext => 'js', :body => body, :digest => digest) }.merge!(options))
end
end.join("\n").html_safe
end
@@ -43,10 +43,10 @@ module Sprockets
sources.collect do |source|
if debug && asset = asset_paths.asset_for(source, 'css')
asset.to_a.map { |dep|
- super(dep.to_s, { :href => asset_path(dep, :ext => 'css', :body => true, :protocol => :request, :digest => digest) }.merge!(options))
+ super(dep.to_s, { :href => path_to_asset(dep, :ext => 'css', :body => true, :protocol => :request, :digest => digest) }.merge!(options))
}
else
- super(source.to_s, { :href => asset_path(source, :ext => 'css', :body => body, :protocol => :request, :digest => digest) }.merge!(options))
+ super(source.to_s, { :href => path_to_asset(source, :ext => 'css', :body => body, :protocol => :request, :digest => digest) }.merge!(options))
end
end.join("\n").html_safe
end
@@ -56,19 +56,20 @@ module Sprockets
path = asset_paths.compute_public_path(source, asset_prefix, options.merge(:body => true))
options[:body] ? "#{path}?body=1" : path
end
-
+ alias_method :path_to_asset, :asset_path # aliased to avoid conflicts with an asset_path named route
+
def image_path(source)
- asset_path(source)
+ path_to_asset(source)
end
alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
def javascript_path(source)
- asset_path(source)
+ path_to_asset(source)
end
alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with an javascript_path named route
def stylesheet_path(source)
- asset_path(source)
+ path_to_asset(source)
end
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with an stylesheet_path named route