method

rewrite_extension

rails latest stable - Class: ActionView::Helpers::AssetTagHelper::AssetPaths

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.2.13) is shown here.

rewrite_extension(source, dir, ext)
private

No documentation available.

# File actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb, line 30
        def rewrite_extension(source, dir, ext)
          source_ext = File.extname(source)

          source_with_ext = if source_ext.empty?
            "#{source}.#{ext}"
          elsif ext != source_ext[1..-1]
            with_ext = "#{source}.#{ext}"
            with_ext if File.exist?(File.join(config.assets_dir, dir, with_ext))
          end

          source_with_ext || source
        end