Closed mveytsman closed 3 years ago
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.
:dump
dump
When using the Ecto typ inside of an embedded schema, we get the following error:
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 thedump
callback, and the error goes away.