jbuilder

https://github.com/rails/jbuilder

Ruby

Jbuilder: generate JSON objects with a Builder-style DSL

JbuilderTemplate#cache!

Caches the json constructed within the block passed. Has the same signature as the `cache` helper
method in `ActionView::Helpers::CacheHelper` and so can be used in the same way.

Example:

  json.cache! ['v1', @person], expires_in: 10.minutes do
    json.extract! @person, :name, :age
  end

Source | Google | Stack overflow

Edit

git clone [email protected]:rails/jbuilder.git

cd jbuilder

open lib/jbuilder/jbuilder_template.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-JbuilderTemplate-cache--for-pr


# Commit to git

git add lib/jbuilder/jbuilder_template.rbgit commit -m "better docs for JbuilderTemplate#cache!"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-JbuilderTemplate-cache--for-pr

hub pull-request


# Celebrate!