mathieuprog / polymorphic_embed

Polymorphic embeds in Ecto
Apache License 2.0
341 stars 63 forks source link

Option to change the `__type__` key #23

Closed icehaunter closed 3 years ago

icehaunter commented 3 years ago

I like having the key to explicitly differentiate between the embeds. It works very nicely with TypeScript's discriminated unions on the frontend. But some other places in my system already use the :type key without the underscores.

Is there a way to add a possibility to change the key? Thanks!

mathieuprog commented 3 years ago

Can you try using version 1.3.2 and let me know if that suits you? When will you be able to test it? New option is :type_field.

Note that lists of polymorphic embeds are also supported now. Breaking change: you are now forced to set the :on_replace option (to :update for single embed and :delete for lists of embeds).