Skip to content

Pass contexts to serializers #21

@Nitemaeric

Description

@Nitemaeric

I want to be able to add custom context to my serializers.

A common use case is passing authentication statuses to serializers.

class Api::V1::PostSerializer < Transmutation::Serializer
  attribute :view_count, if: -> { current_user.admin? }
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions