1

Alias parsing was not enabled getting psych error when upgrading rails from 5.2 to 6.0.6.1

.rvm/gems/ruby-2.7.8@reports2/gems/psych-5.1.0/lib/psych/visitors/to_ruby.rb:432:in `visit_Psych_Nodes_Alias': Cannot load database configuration:

Alias parsing was not enabled. To enable it, pass `aliases: true` to `Psych::load` or `Psych::safe_load`. (Psych::AliasesNotEnabled)

please provide some solid solution for this error.

my changes
in environment.rb file
require_relative 'application'
in development.rb file
config.cache_store = :redis_cache_store
in asset.rb
Rails.application.config.assets.paths << Rails.root.join('node_modules')
in application.rb
require_relative 'boot'
config.load_defaults 6.0

  • I just upgraded a big application from 5.max to Rails 6.max and didn't see this issue. It's likely with a way you're loading stuff from a file. The stack trace should give you a good indication on where this error is coming from. What is the line that is causing it? – Thomas Jun 02 '23 at 01:17
  • /home/username/.rbenv/versions/3.2.2/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:432:in 'visit_Psych_Nodes_Alias': Cannot load 'Rails.application.database_configuration' – b264 Jul 11 '23 at 19:21

0 Answers0