Alias parsing was not enabled

I recently upgraded my Ruby from 2.4 to 3.3.4 because I couldn’t make it work on my new linux distro and some issues occurred:

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

I found this:

YAML.load(erb.result, aliases: true)

but that’s for Rails I don’t understand where to put it or how to do it.

so I added this to my Gemfile:
gem ‘psych’, ‘< 4’

seems like it worked but only to some degree because now I get for example this:

YAML Exception parsing Unknown alias: title or Unknown alias: name

file itself:

name: &name “Kyle”
title: *name

I can’t really downgrade Ruby to previous version, is there any solution to this?