mavenlink/brainstem — pull request #31 by ahuth (2014-06-22 05:21:59+00:00)
Title: Pretty print

This pull request adds support for a `pretty` parameter which causes the json response to be rendered in a pretty-printed format. Should close out issue #10.

It works by adding a `to_json` method to the object returned by PresenterCollection. When you do `render :json => ...` in a Rails controller, `to_json` gets called automatically, which handles rendering the json in a pretty format.

Not sure if or when pull request #30 will get merged. If that one goes first, though, I should probably merge master back into this one before it goes in.

Finally, I made a test app for this change, and you can see it working.

Here is the rendered JSON without the pretty option:
![regular](https://cloud.githubusercontent.com/assets/2503289/3350705/823cd2f4-f9cc-11e3-898a-a3a17945cc60.png)

And here it is with the pretty option:
![pretty](https://cloud.githubusercontent.com/assets/2503289/3350706/95295f36-f9cc-11e3-97ae-1a09155d19ea.png)