end
def self.legacy_load(s)
- val = Psych.safe_load(s)
+ val = Psych.safe_load(s, permitted_classes: [Time])
if val.is_a? String
# If apiserver was downgraded to a YAML-only version after
# storing JSON in the database, the old code would have loaded
end
def self.load(s)
- if s.nil?
+ if s.is_a?(object_class)
+ # Rails already deserialized for us
+ s
+ elsif s.nil?
object_class.new()
elsif s[0] == first_json_char
SafeJSON.load(s)