jbuilder-prettify
This gem provides an easy way to configure pretty output with jbuilder.
Installation
Add this line to your application's Gemfile:
gem 'jbuilder-prettify'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jbuilder-prettify
Usage
Enable pretty output in development environment (config/environments/development.rb
)
config.jbuilder.prettify = true
or set it in a controller based on the current request
class ApplicationController < ActionController::Base
before_action :prettify_json
def prettify_json
Jbuilder.prettify = %w( 1 true yes ).includes?(params[:pretty_json])
end
end
Contributing
- Fork it ( https://github.com/SICSoftwareGmbH/jbuilder-prettify/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request