diff options
author | eileencodes <eileencodes@gmail.com> | 2019-03-13 13:11:10 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2019-03-13 13:11:10 -0400 |
commit | a2bd669ed240bec739074188d61ff125e07fa8d1 (patch) | |
tree | f16681562c906e3a8881d010e252b0a3a1dfe5ae /railties/lib/rails | |
parent | 1dc4d49f517e5cea99063afd9692b201199484ef (diff) | |
parent | 7c87fd5635fd830905e17d3cbf1eb2a2215acedf (diff) | |
download | rails-a2bd669ed240bec739074188d61ff125e07fa8d1.tar.gz rails-a2bd669ed240bec739074188d61ff125e07fa8d1.tar.bz2 rails-a2bd669ed240bec739074188d61ff125e07fa8d1.zip |
Merge tag 'v6.0.0.beta3'
v6.0.0.beta3 release
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/application.rb | 19 | ||||
-rw-r--r-- | railties/lib/rails/gem_version.rb | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index fbad3e5db3..558a4d1f57 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -415,8 +415,8 @@ module Rails # then credentials.secret_key_base, and finally secrets.secret_key_base. For most applications, # the correct place to store it is in the encrypted credentials file. def secret_key_base - if Rails.env.test? || Rails.env.development? - secrets.secret_key_base || Digest::MD5.hexdigest(self.class.name) + if Rails.env.development? || Rails.env.test? + secrets.secret_key_base ||= generate_development_secret else validate_secret_key_base( ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base @@ -581,6 +581,21 @@ module Rails private + def generate_development_secret + if secrets.secret_key_base.nil? + key_file = Rails.root.join("tmp/development_secret.txt") + + if !File.exist?(key_file) + random_key = SecureRandom.hex(64) + File.binwrite(key_file, random_key) + end + + secrets.secret_key_base = File.binread(key_file) + end + + secrets.secret_key_base + end + def build_request(env) req = super env["ORIGINAL_FULLPATH"] = req.fullpath diff --git a/railties/lib/rails/gem_version.rb b/railties/lib/rails/gem_version.rb index 249894f9d0..fea24810f5 100644 --- a/railties/lib/rails/gem_version.rb +++ b/railties/lib/rails/gem_version.rb @@ -10,7 +10,7 @@ module Rails MAJOR = 6 MINOR = 0 TINY = 0 - PRE = "beta2" + PRE = "beta3" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end |