class Blueprinter::Base

def self.association(method, options = {}, &block)

Returns:
  • (Field) - A Field object

Other tags:
    Example: Passing a block to be evaluated as the value. -
    Example: Specifying an association -

Other tags:
    Yield: - The object and the options passed to render are

Options Hash: (**options)
  • :view (Symbol) -- Specify the view to use or fall back to
  • :name (Symbol) -- Use this to rename the association in the
  • :blueprint (Symbol) -- Required. Use this to specify the

Parameters:
  • options (Hash) -- options to overide defaults.
  • method (Symbol) -- the association name
def self.association(method, options = {}, &block)
  validate_blueprint!(options[:blueprint], method)
  field(
    method,
    options.merge(
      association: true,
      extractor: options.fetch(:extractor) { AssociationExtractor.new }
    ),
    &block
  )
end