Skip to content

Avoid playing with Oj shared default_optionsΒ #744

@BuonOmo

Description

@BuonOmo

Oj.default_options = { :mode => :compat, :time_format => :ruby, :use_to_json => true }

This line causes a lot of trouble for anyone using Oj and requiring rabl after having set Oj themselves:

Oj.default_options = my = { mode: :strict }
require "rabl"

Oj.default_options != my

Oj has its share of responsibility on that, however, IMHO the bug comes from rabl.

I'd love to fix it by using MultiJson, yet I came across one of your commits removing it (9bfb1a4).

Another option may be to have a condition in the format_json method, but I'm not a big fan..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions