Method: Blueprinter::Base.exclude

Defined in:
lib/blueprinter/base.rb

.exclude(field_name) ⇒ Array<Symbol>

Exclude a field that was mixed into the current view.

Examples:

Excluding a field from being included into the current view.

view :normal do
  fields :position, :company
end
view :special do
  include_view :normal
  field :birthday
  exclude :position
end
#=> [:company, :birthday]

Parameters:

  • field_name (Symbol)

    the field to exclude from the current view.

Returns:

  • (Array<Symbol>)

    an array of field names



381
382
383
# File 'lib/blueprinter/base.rb', line 381

def self.exclude(field_name)
  current_view.exclude_field(field_name)
end