When passing create_additions: true to the Oj.default_options, I expected that option to be applied to the JSON parsing APIs, but it seems to be ignored.
Oj.default_options = {create_additions: true}
Oj.optimize_rails
class Foo
def initialize(data)
@data = data
end
def as_json(*pargs, **kwargs, &blk)
{
"json_class" => self.class.name,
"data" => @data
}.as_json(*pargs, **kwargs, &blk)
end
def self.json_create(object, *)
self.new(object["data"])
end
end
When passing
create_additions: true
to theOj.default_options
, I expected that option to be applied to the JSON parsing APIs, but it seems to be ignored.Actual behavior:
Expected behavior:
Is this a bug or am I doing something wrong?