Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs #36219 - allow loading HashWithIndifferentAccess from YAML #9782

Merged
merged 1 commit into from Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/report.rb
Expand Up @@ -62,7 +62,7 @@ def self.inherited(child)
# extracts serialized metrics and keep them as a hash_with_indifferent_access
def metrics
return {} if self[:metrics].nil?
YAML.safe_load(read_metrics).with_indifferent_access
YAML.safe_load(read_metrics, permitted_classes: [ActiveSupport::HashWithIndifferentAccess]).with_indifferent_access
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative solution would be to make read_metrics not return HWIA, but I wasn't sure the mangling in that function is the only way for the data to get HWIA header, so this seemed safer.

end

# serialize metrics as YAML
Expand Down