diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-08-12 20:18:03 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-08-12 20:18:03 -0700 |
commit | 1b127fcdea28d6c6ab2f2c6370125c8817ba99d6 (patch) | |
tree | bf175900629b88ceb709a1f4df8aca9ec533cacc /actionpack/lib/action_view | |
parent | 45b79d933cd2433b30ae98e7dadc4ae060e170c9 (diff) | |
download | rails-1b127fcdea28d6c6ab2f2c6370125c8817ba99d6.tar.gz rails-1b127fcdea28d6c6ab2f2c6370125c8817ba99d6.tar.bz2 rails-1b127fcdea28d6c6ab2f2c6370125c8817ba99d6.zip |
Set asset-cached file ctime and mtime to the max mtime of the combined files. Allows for consistent ETag generation without having a shared filesystem.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 1e44b166d9..c2b4f51c9c 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -618,6 +618,11 @@ module ActionView def write_asset_file_contents(joined_asset_path, asset_paths) FileUtils.mkdir_p(File.dirname(joined_asset_path)) File.open(joined_asset_path, "w+") { |cache| cache.write(join_asset_file_contents(asset_paths)) } + + # Set mtime to the latest of the combined files to allow for + # consistent ETag without a shared filesystem. + mt = asset_paths.map { |p| File.mtime(File.join(ASSETS_DIR, p)) }.max + File.utime(mt, mt, joined_asset_path) end def collect_asset_files(*path) |