Module: ActiveModel::Serializer::Meta::ClassMethods

Defined in:
lib/active_model/serializer/concerns/meta.rb

Instance Method Summary collapse

Instance Method Details

#meta(value = nil, &block) ⇒ Object

Set the JSON API meta attribute of a serializer.

Examples:

class AdminAuthorSerializer < ActiveModel::Serializer
  meta { stuff: 'value' }
meta do
  { comment_count: object.comments.count }
end


23
24
25
# File 'lib/active_model/serializer/concerns/meta.rb', line 23

def meta(value = nil, &block)
  self._meta = block || value
end