lib/sprockets/helpers/rails_helper.rb in actionpack-3.1.12 vs lib/sprockets/helpers/rails_helper.rb in actionpack-3.2.0.rc1
- old
+ new
@@ -62,29 +62,24 @@
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)
- path_to_asset(source, :ext => 'js')
+ 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)
- path_to_asset(source, :ext => 'css')
+ path_to_asset(source)
end
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with an stylesheet_path named route
private
def debug_assets?
- begin
- compile_assets? &&
- (Rails.application.config.assets.debug ||
- params[:debug_assets] == '1' ||
- params[:debug_assets] == 'true')
- rescue NoMethodError
- false
- end
+ compile_assets? && (Rails.application.config.assets.debug || params[:debug_assets])
+ rescue NoMethodError
+ false
end
# Override to specify an alternative prefix for asset path generation.
# When combined with a custom +asset_environment+, this can be used to
# implement themes that can take advantage of the asset pipeline.
@@ -158,10 +153,10 @@
source
end
end
def rewrite_extension(source, dir, ext)
- if ext && File.extname(source).empty?
+ if ext && File.extname(source) != ".#{ext}"
"#{source}.#{ext}"
else
source
end
end