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

Configuration

Blueprinter V2 has no concept of global configruation like V1’s Blueprinter.configure. Instead, blueprints and views inherit configuration from their parent classes. By putting your “global” configuration into ApplicationBlueprint, all your application’s blueprints and views will inherit it.

class ApplicationBlueprint < Blueprinter::Blueprint
  options[:exclude_if_nil] = true
  extensions << MyExtension.new
end

Read more about options and extensions.

Overrides

Child classes, views, and partials can override their inherited configuration.

class MyBlueprint < ApplicationBlueprint
  options[:exclude_if_nil] = false

  view :foo do
    options.clear
    extensions.clear
  end
end