Allow raw/native JSON in JS config object, e.g. checkIgnore function #821
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #648
Fixes #710
Use
Rollbar::JSON::Value
to pass native JSON values, without enclosing string quotes.Example:
Ruby
JSON.generate
vs. ActiveSupport#to_json
and#as_json
When serializing the js_options object, the middleware now uses Ruby
JSON.generate
instead of ActiveSupport's#to_json
.Early versions of ActiveSupport could use the
#encode_json
method to get a similar ability to inject values without enclosing quote marks.ActiveSupport before version 4.1.0 supported the
#encode_json
method, and then the activesupport-json_encoder gem did for Rails < 5.x. For Rails 5.x, the desired functionality doesn't appear achievable via ActiveSupport. For all versions, the dependencies and requirements are fragmented, and the functionality would not work at all on a Rack app without ActiveSupport.The native Ruby
JSON#generate
works consistently across all versions of Ruby and imposes no dependencies on users of the gem. The encoder requirement is only on the generation of the js_options object in the middleware and has no impact on other JSON objects in the gem, or on the host application.