rails/jbuilder — pull request #186 by johnkchow (2014-04-15 07:03:41+00:00)
Title: Allow #merge! to accept Jbuilder objects

The documentation didn't have any example on how to use jbuilders within an `#array!` block call, so after digging around the source code I realize that there's a `#merge!` method that I can use. This change makes the code cleaner when trying to use Jbuilder objects within the array! block.

Original code would look like:

```ruby
json.array! @people do |person|
json.merge! person.to_builder.attributes!
end
```

New code would look like:

```ruby
json.array! @people do |person|
json.merge! person.to_builder
end
```

I was tempted to not even include the `json.merge!` and have the block be smart about what object is returned, but I figure this is consistent with the rest of the API.