Skip to content

Single attribute with serializer parameter #479

@Mikkko

Description

@Mikkko

Is it possible to pass serializer name as parameter with a single attribute?
attribute :attribute_name, serializer: SerializerName

instead of:

attribute :attribute_name do |object|
  SerializerName.new(object.attribute_name)
end

We can do it with relationships, when we call has_many or another type, but I cannot find it for single attribute

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions