Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/ecto/changeset.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,22 @@ defmodule Ecto.Changeset do
changeset
|> cast_assoc(:children, sort_param: ..., with: &child_changeset/3)

When using `:drop_param`, the remaining elements are re-indexed sequentially
starting from 0. For example, if you have the following parameters:

%{
"addresses" => %{
0 => %{"street" => "First St"},
1 => %{"street" => "Second St"},
2 => %{"street" => "Third St"}
},
"addresses_drop" => [1]
}

The element originally at index `2` ("Third St") will be passed to the `:with`
function with position `1`, because the list is compacted after the drop
operation.

These parameters can be powerful in certain UIs as it allows you to decouple
the sorting and replacement of the data from its representation.

Expand Down