Skip to content

This syntax works but is not documented #149

Description

@benlieb

I have found the following line of code in our app:

class ClientSerializer
  include JSONAPI::Serializer
  ...
  has_one :credit_card_unsaved, serializer: :credit_card, &:credit_card_unsaved
end

This as the effect of calling the INSTANCE method credit_card_unsaved, and serializing it properly with the CreditCardSerializer. This is the exact functionality that we need since we don't want actual rails associations for some of the data we want to serialize.

However this syntax does not seem to be documented anywhere. I would love for this to be explained to me. Is this expected behavior? If this is part of the api, then could you please document it? I would like to have some confidence that this behavior is expected and expected to keep working indefinitely.

Thanks!

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