Skip to content

Pass required to cast_embed/3 not validate_required/3#16

Open
thetamind wants to merge 1 commit intoblunt-elixir:reorgfrom
thetamind:cast-embed-required
Open

Pass required to cast_embed/3 not validate_required/3#16
thetamind wants to merge 1 commit intoblunt-elixir:reorgfrom
thetamind:cast-embed-required

Conversation

@thetamind
Copy link

Ecto 3.8.0 introduced a warning that calling validate_required/3 on embeds_many has no effect.
elixir-ecto/ecto#3862

Pass :required option to cast_embed/3 instead.

warning: attempting to validate embed_many field :many with validate_required/3 which has no effect. You can pass the :required option to Ecto.Changeset.cast_embed/3 to achieve this.
  (ecto 3.8.3) lib/ecto/changeset.ex:1801: anonymous fn/6 in Ecto.Changeset.validate_required/3
  (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
  (ecto 3.8.3) lib/ecto/changeset.ex:1800: Ecto.Changeset.validate_required/3
  (blunt 0.1.0-rc1) lib/blunt/message/changeset.ex:75: Blunt.Message.Changeset.changeset/3
  (blunt 0.1.0-rc1) lib/blunt/message/constructor.ex:68: Blunt.Message.Constructor.apply/4

Ecto 3.8.0 introduced a warning that calling validate_required/3 on
embeds_many has no effect.
elixir-ecto/ecto#3862
@thetamind thetamind changed the title pass required to cast_embed/3 not validate_required/3 Pass required to cast_embed/3 not validate_required/3 Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant