1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #42249 from byroot/psych-4-support

Fix compatibility with Psych 4
This commit is contained in:
Jean Boussier 2021-05-18 10:14:49 +02:00 committed by GitHub
commit 179d0a1f47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,12 @@ module ActiveSupport
end
def parse(context: nil, **options)
YAML.load(render(context), **options) || {}
source = render(context)
begin
YAML.load(source, aliases: true, **options) || {}
rescue ArgumentError
YAML.load(source, **options) || {}
end
rescue Psych::SyntaxError => error
raise "YAML syntax error occurred while parsing #{@content_path}. " \
"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \