aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-03-14 15:39:23 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-03-14 16:14:15 +0900
commit0187053109f62ea0188a76aee53aeee396f76632 (patch)
tree94e69cb5fdb6a3b9892fdff226cb2fa7e596774e /railties/lib
parent25620f91ca0ab261fbc883763040ec58d205514e (diff)
downloadrails-0187053109f62ea0188a76aee53aeee396f76632.tar.gz
rails-0187053109f62ea0188a76aee53aeee396f76632.tar.bz2
rails-0187053109f62ea0188a76aee53aeee396f76632.zip
Make application work without tmp directory
The tmp directory is added to version control in the newly created application. This was added in Rails 5.0.0(https://github.com/rails/rails/commit/f06ce4c12a396795a3b2c1812951d9277bcb3a82). However, applications created before that are not guaranteed to have the tmp directory. If the tmp directory does not exist, writing to the key file raise error. This is a bit incompatible. So I fixed that create the directory before writing a key.
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/application.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 558a4d1f57..6bc6c548d2 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -587,6 +587,7 @@ module Rails
if !File.exist?(key_file)
random_key = SecureRandom.hex(64)
+ FileUtils.mkdir_p(key_file.dirname)
File.binwrite(key_file, random_key)
end