lib/rails-settings/base.rb in rails-settings-cached-2.8.1 vs lib/rails-settings/base.rb in rails-settings-cached-2.8.2
- old
+ new
@@ -13,10 +13,14 @@
self.table_name = table_name_prefix + "settings"
# get the value field, YAML decoded
def value
# rubocop:disable Security/YAMLLoad
- YAML.load(self[:value]) if self[:value].present?
+ payload = self[:value]
+
+ if payload.present?
+ YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(payload) : YAML.load(payload)
+ end
end
# set the value field, YAML encoded
def value=(new_value)
self[:value] = new_value.to_yaml