Skip to content

Commit

Permalink
Rails mimic json (#664)
Browse files Browse the repository at this point in the history
* Fix issue with Rails.mimic_JSON

* Release prep
  • Loading branch information
ohler55 committed Jun 22, 2021
1 parent ec6767e commit cd6920f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# CHANGELOG

## 3.11.7 - 2021-06-22

- Fixed exception type when parsing after `Oj::Rails.mimic_JSON` is called.

## 3.11.6 - 2021-06-14

- Fixed bug where `Oj::Doc#fetch` on an empty Hash or Array did not return `nil`.
Expand Down
2 changes: 1 addition & 1 deletion ext/oj/parse.c
Expand Up @@ -1129,7 +1129,7 @@ oj_pi_parse(int argc, VALUE *argv, ParseInfo pi, char *json, size_t len, int yie
if (Qnil != pi->err_class) {
pi->err.clas = pi->err_class;
}
if (CompatMode == pi->options.mode && Yes != pi->options.safe) {
if ((CompatMode == pi->options.mode || RailsMode == pi->options.mode) && Yes != pi->options.safe) {
// The json gem requires the error message be UTF-8 encoded. In
// additional the complete JSON source must be returned. There
// does not seem to be a size limit.
Expand Down
2 changes: 1 addition & 1 deletion ext/oj/rails.c
Expand Up @@ -828,7 +828,7 @@ rails_mimic_json(VALUE self) {
json = rb_define_module("JSON");
}
oj_mimic_json_methods(json);
// oj_default_options.mode = RailsMode;
oj_default_options.mode = RailsMode;

return Qnil;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/oj/version.rb
@@ -1,5 +1,5 @@

module Oj
# Current version of the module.
VERSION = '3.11.6'
VERSION = '3.11.7'
end

0 comments on commit cd6920f

Please sign in to comment.