Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10337 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Ensure folder structure for cached assets

Reported by: josh Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords:
Cc:

Description

If you have you cached assets set to a subfolder like "javascripts/cache/all.js", you need to make sure you have the cache folder checked into your repository. This causes a problem for me because my svn (git) does not track empty folders.

This patch makes the folder directory for the cached asset if it does not already exist. I also refactored some of the similarities between "stylesheet_link_tag" and "javascript_include_tag".

Attachments

ensure_cached_assets_folder_structure.diff (5.8 kB) - added by josh on 12/10/07 04:47:56.
fix_broken_javascript_when_uncached.diff (1.1 kB) - added by chuyeow on 12/10/07 08:18:16.

Change History

12/10/07 02:56:35 changed by tpope

+1. There's little downside to this and the refactoring is a nice touch.

12/10/07 03:26:18 changed by bitsweat

Tests?

12/10/07 04:47:56 changed by josh

  • attachment ensure_cached_assets_folder_structure.diff added.

12/10/07 04:48:15 changed by josh

Updated w/ tests.

12/10/07 06:09:34 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [8366]) Ensure asset cache directories are automatically created. Closes #10337.

12/10/07 08:16:31 changed by chuyeow

  • status changed from closed to reopened.
  • resolution deleted.

For some reason when perform_caching is false (I was working on edge in development env for one of my projects, just updated vendor/rails to HEAD), the javascript_tag defined in asset_tag_helper.rb is not used. Instead JavaScriptHelper#javascript_tag is called instead resulting in generated HTML like this:

<script type="text/javascript">
//<![CDATA[
jquery
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
jquery.tablesorter.js
//]]>
</script>

I'm attaching a patch that renames javascript_tag to javascript_src_tag to avoid this possibly insidious name collision.

12/10/07 08:18:16 changed by chuyeow

  • attachment fix_broken_javascript_when_uncached.diff added.

12/10/07 09:12:53 changed by bitsweat

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [8368]) Fix javascript_tag method name collision. Closes #10337.