diff options
Diffstat (limited to 'actionpack/lib/sprockets/helpers')
| -rw-r--r-- | actionpack/lib/sprockets/helpers/rails_helper.rb | 22 | 
1 files changed, 9 insertions, 13 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb index ddf9b08b54..c34b3f6f26 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.pathname.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.pathname.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 @@ -113,11 +114,6 @@ module Sprockets          class AssetNotPrecompiledError < StandardError; end -        # Return the filesystem path for the source -        def compute_source_path(source, ext) -          asset_for(source, ext) -        end -          def asset_for(source, ext)            source = source.to_s            return nil if is_uri?(source) @@ -154,7 +150,7 @@ module Sprockets          end          def rewrite_extension(source, dir, ext) -          if ext && File.extname(source).empty? +          if ext && File.extname(source) != ".#{ext}"              "#{source}.#{ext}"            else              source  | 
