Fixed issue where it was impossible to turn off JSON callback wrapping #28

merged 2 commits into from Jul 1, 2012


None yet

2 participants



It was impossible to turn off json_callback via configuration files because it always fall backs to default "true" value.. Eg it results a double wrapping when using json_builder with rack_contrib (old one).

@dewski dewski commented on an outdated diff Jun 26, 2012
@@ -45,8 +45,8 @@ def generate(*args, &block)
def initialize(options={})
@_members = []
@_scope = options[:scope]
- @_callback = options[:callback] || true
- @_pretty_print = options[:pretty] || false
+ @_callback = options.has_key?(:callback) ? options[:callback] : true
+ @_pretty_print = options.has_key?(:pretty) ? options[:pretty] : false
dewski Jun 26, 2012

Can you update this to just use Hash#fetch?

options.fetch(:pretty, false)

Looks good! Just take a look at the PR comment I made then I'll merge it.


Hi! Right idea! Now it fixed.

@dewski dewski merged commit bf764da into dewski:master Jul 1, 2012

Pushed 3.1.4 to RubyGems. Thanks again for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment