Defect #35435

Updated by Go MAEDA 3 months ago

see for details
https://github.com/ruby/psych/pull/487
https://github.com/rails/rails/commit/1e56b1d1152e8ab74203db30625116844614cc78

patch
<pre><code class="diff"> &lt;pre&gt;
diff --git a/Gemfile b/Gemfile
index b83cd2215..8f6bbe946 100644
--- a/Gemfile
+++ b/Gemfile
@@ -52,7 +52,8 @@ require 'erb'
require 'yaml'
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
if File.exist?(database_file)
- database_config = YAML::load(ERB.new(IO.read(database_file)).result)
+ yaml_config = ERB.new(IO.read(database_file)).result
+ database_config = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(yaml_config) : YAML.load(yaml_config)
adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
if adapters.any?
adapters.each do |adapter|
</code></pre> &lt;/pre&gt;

without this change, Psych 4 will break aliases in config/database.yml
<pre>
production: &alias
adapter: mysql2
database: xxx

development: *alias
</pre>

error
<pre>
Cannot load database configuration: (Psych::BadAlias)
Unknown alias: alias
</pre>

Back