Polymorphic_embed - polymorphic Embeds in Ecto

polymorphic_embed is now using ParameterizedType! :clap:

Polymorphic embeds are now specified as parameters on the field:

schema "reminders" do
  field :channel, PolymorphicEmbed,
    types: [
      sms: MyApp.Channel.SMS,
      email: MyApp.Channel.Email
    ]

No more intermediary module for options, code injection and macros.

Note also that for those using it, an (unrelated) bugfix requires now casting params for polymorphic embeds through cast_polymorphic_embed/2 instead of cast/4.

See example in readme.

2 Likes