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

If/unless options

V2’s if and unless options have different Proc arguments than legacy/V1. If you enable the LegacyOptions extension, if/unless Procs with three arguments will continue to work like they did in V1:

field :a, if: ->(field_name, object, options) { object.active? }

V2 style

V2-style if/unless Procs will continue to work. They accept a single Blueprinter::V2::Context::Field argument:

field :a, if: ->(ctx) {
  field_name = ctx.field.source
  object = ctx.object
  options = ctx.options
  object.active?
}