Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Blueprinter

Warning

This is a WIP for API V2!

Blueprinter is a JSON serializer for your business objects. It is designed to be simple, flexible, and performant.

Upgrading from Blueprinter V1? Read over the changes!

Installation

bundle add blueprinter

See rubydoc.info/gems/blueprinter for API documentation.

Basic Usage

class WidgetBlueprint < ApplicationBlueprint
  field :name
  association :category, CategoryBlueprint
  association :parts, [PartBlueprint]

  view :extended do
    field :description
    association :manufacturer, CompanyBlueprint
    association :vendors, [CompanyBlueprint]
  end
end

# Render the default view to JSON
WidgetBlueprint.render(widget).to_json

# Render the extended view to a Hash
WidgetBlueprint[:extended].render(widget).to_hash