mathieuprog / polymorphic_embed

Polymorphic embeds in Ecto
Apache License 2.0
335 stars 62 forks source link

Ecto "Parametrized" breaking change #110

Closed frozencap closed 2 months ago

frozencap commented 2 months ago

The example in the README fails with latest ecto with the following error:

** (TryClauseError) no try clause matching: {:parameterized, {PolymorphicEmbed, %{default: nil, on_replace: :update, types_metadata: [%{module: MyApp.Channel.SMS, type: :sms, identify_by_fields: []}, %{module: MyApp.Channel.Email, type: :email, identify_by_fields: []}], type_field: "__type__", on_type_not_found: :raise, type_field_atom: :__type__}}}
    (polymorphic_embed 3.0.7) lib/polymorphic_embed.ex:443: PolymorphicEmbed.get_field_options/2
    (polymorphic_embed 3.0.7) lib/polymorphic_embed.ex:117: PolymorphicEmbed.cast_polymorphic_embed/3
    #cell:brjcaekzmw6iuns3:25: MyApp.Reminder.changeset/2
    #cell:brjcaekzmw6iuns3:67: (file)

gist: https://gist.github.com/frozencap/76e0dc3eb3d4d1e39182461680b56d1f

EDIT: looks like the fix here just hasn't been released yet https://github.com/mathieuprog/polymorphic_embed/commit/a92bea891996073d28d4ec40d78ee1dd08ab82f8

frozencap commented 2 months ago

EDIT: looks like the fix here just hasn't been released yet https://github.com/mathieuprog/polymorphic_embed/commit/a92bea891996073d28d4ec40d78ee1dd08ab82f8

just use in mix.exs > deps

      {:polymorphic_embed,
       github: "mathieuprog/polymorphic_embed", branch: "master", override: true},