Ensure file atomic write uses the cache directory as its tmp folder

This commit is contained in:
Joshua Peek
2008-08-06 17:22:58 -05:00
parent 165120a606
commit c6b7d0f344

View File

@@ -15,7 +15,7 @@ module ActiveSupport
def write(name, value, options = nil)
super
ensure_cache_path(File.dirname(real_file_path(name)))
File.atomic_write(real_file_path(name)) { |f| f.write(value) }
File.atomic_write(real_file_path(name), cache_path) { |f| f.write(value) }
rescue => e
RAILS_DEFAULT_LOGGER.error "Couldn't create cache directory: #{name} (#{e.message})" if RAILS_DEFAULT_LOGGER
end