Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails mimic json #664

Merged
merged 2 commits into from Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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