From d91ac89ab83735ad1149907e942c2b0d67e03a56 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 7 Feb 2010 22:01:54 +0100 Subject: AS guide: specifies that renaming a file is atomic on POSIX systems --- railties/guides/source/active_support_core_extensions.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source/active_support_core_extensions.textile') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 4f7c0c56e2..2d05e66307 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -2118,7 +2118,7 @@ File.atomic_write(joined_asset_path) do |cache| end -To accomplish this +atomic_write+ creates a temporary file. That's the file the code in the block actually writes to. On completion, the temporary file is renamed. If the target file exists +atomic_write+ overwrites it and keeps owners and permissions. +To accomplish this +atomic_write+ creates a temporary file. That's the file the code in the block actually writes to. On completion, the temporary file is renamed, which is an atomic operation on POSIX systems. If the target file exists +atomic_write+ overwrites it and keeps owners and permissions. WARNING. Note you can't append with +atomic_write+. -- cgit v1.2.3