dewski / json_builder

Rails provides an excellent XML Builder by default to build RSS and ATOM feeds, but nothing to help you build complex and custom JSON data structures. JSON Builder is here to help.
http://garrettbjerkhoel.com/json_builder/
MIT License
243 stars 52 forks source link

Ruby 2.1.0 support #49

Open philrosenstein opened 10 years ago

philrosenstein commented 10 years ago

I've upgraded my Rails 2.3.18 app to work with Ruby 2.1.0 ( requires a couple monkey patches described here http://djellemah.com/blog/2013/02/27/rails-23-with-ruby-20/ )

json_builder templates are now throwing the following error:

undefined method json_builder_member_path for #<ActionView::Base ../gems/actionpack-2.3.18/lib/action_controller/polymorphic_routes.rb:107:in polymorphic_url ../gems/actionpack-2.3.18/lib/action_controller/polymorphic_routes.rb:114:in polymorphic_path ../gems/actionpack-2.3.18/lib/action_view/helpers/url_helper.rb:91:in url_for ../gems/actionpack-2.3.18/lib/action_view/helpers/url_helper.rb:228:in link_to ../gems/json_builder-3.1.7/lib/json_builder/compiler.rb:85:in method_missing ...

Is there a known issue with json_builder with Ruby 2? I don't think it's the monkey patches because it still works using the same patches with Ruby 1.9.3

philrosenstein commented 10 years ago

the above seemed to be cause by a link_to in the json builder template. By getting rid of the link to only attempting to use a url helper, I encounter the same error described by this closed issue: https://github.com/dewski/json_builder/issues/6 JSON::ParserError unexpected token at '{"root_url": null, "username": "root_url": null,