Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecto.Type: Switch embed_as to :dump #80

Merged
merged 1 commit into from
Aug 19, 2021
Merged

Commits on Jun 1, 2021

  1. Ecto.Type: Switch embed_as to :dump

    When using the Ecto typ inside of an embedded schema, we get the following error:
    
    ```
    protocol Jason.Encoder not implemented for ~e[0 12 * * 1 *] of type Crontab.CronExpression (a struct), Jason.Encoder protocol must always be explicitly implemented.
    ```
    
    This is because by default the type will be embedded as a JSON dump of it's struct (see https://hexdocs.pm/ecto/Ecto.Type.html#c:embed_as/1)
    
    Switching to `:dump` means that when embedding this type in a embedded schema we still call the `dump` callback, and the error goes away.
    mveytsman authored Jun 1, 2021
    Configuration menu
    Copy the full SHA
    88ceb08 View commit details
    Browse the repository at this point in the history