File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1160,6 +1160,22 @@ defmodule Ecto.Changeset do
11601160 changeset
11611161 |> cast_assoc(:children, sort_param: ..., with: &child_changeset/3)
11621162
1163+ When using `:drop_param`, the remaining elements are re-indexed sequentially
1164+ starting from 0. For example, if you have the following parameters:
1165+
1166+ %{
1167+ "addresses" => %{
1168+ 0 => %{"street" => "First St"},
1169+ 1 => %{"street" => "Second St"},
1170+ 2 => %{"street" => "Third St"}
1171+ },
1172+ "addresses_drop" => [1]
1173+ }
1174+
1175+ The element originally at index `2` ("Third St") will be passed to the `:with`
1176+ function with position `1`, because the list is compacted after the drop
1177+ operation.
1178+
11631179 These parameters can be powerful in certain UIs as it allows you to decouple
11641180 the sorting and replacement of the data from its representation.
11651181
You can’t perform that action at this time.
0 commit comments