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:
commit
179d0a1f47
1 changed files with 6 additions and 1 deletions
|
@ -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. " \
|
||||
|
|
Loading…
Reference in a new issue