json_builder icon indicating copy to clipboard operation
json_builder copied to clipboard

Rendering partials

Open donaldpiret opened this issue 14 years ago • 7 comments

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

donaldpiret avatar Dec 05 '11 10:12 donaldpiret

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.

dewski avatar Dec 05 '11 19:12 dewski

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.

syrnick avatar Oct 31 '12 15:10 syrnick

@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.

dewski avatar Nov 02 '12 06:11 dewski

+1

swards avatar Nov 05 '12 22:11 swards

Why the partial branch isn't merged yet?

arielpts avatar May 07 '13 14:05 arielpts

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

MGPalmer avatar Jul 02 '13 11:07 MGPalmer

Need this too

deefens avatar Nov 01 '13 22:11 deefens