bsiggelkow/jsonify-rails — Issue #5: Rendering a partial within a loop
Author: lagartoflojo
Created: 2011-10-30 03:23:10+00:00
State: open

Hi,
I'm trying to render a partial multiple times (for the index action) and it's only returning the last item:

Partial **_child.json.jsonify**
```ruby
json.name child.name
```

File **index.json.jsonify**
```ruby
@children.each do |child|
json.ingest!(render partial: child)
end
```

Actual result:
```json
{"name":"Pedrito"}
```

Expected result:
```json
[{"name":"Horacio"},{"name":"Pepito"},{"name":"Pedrito"}]
```

I also tried:
```ruby
@children.each do |child|
json << json.ingest!(render partial: child)
end
```

But the result was:
```json
{"name":"Pedrito","#":null,"[#]":null,"[#]":null}
```