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

Rendering partials #13

Open donaldpiret opened 12 years ago

donaldpiret commented 12 years ago

How would I work with partials and json_builder to avoid duplication?

With builder I can do something like:

xml.destinations do
  @destinations.each do |destination|
    xml << render(:partial => 'destination', :object => destination)
  end
end
dewski commented 12 years ago

Currently there is no way to do this, but I would like to include this in the next version and get it in there as soon as possible. If you'd like to take a stab at it let me know.

syrnick commented 11 years ago

any progress on this? I really like the json_builder syntax, but lack of partials is a blocker for me.

I'm looking for a basic use case, where /show.json.json_builder , /edit.json.json_builder and /index.json.json_builder all refer to the same partial, say, _widget.json.json_builder.

dewski commented 11 years ago

@syrnick there is still some work left to do, but it's rather close. If you feel confident enough you can use the development version here.

swards commented 11 years ago

+1

arielpts commented 11 years ago

Why the partial branch isn't merged yet?

MGPalmer commented 11 years ago

+1, can't use this without partials :(

deefens commented 10 years ago

Need this too