pagination.ex: Drop atom keys in params
Atom keys could also have been transformed to string, or the other way around but this one is more efficient and what we actually expect with the current param_types in Pagination
This commit is contained in:
parent
6f15224053
commit
e83ad12c57
|
@ -36,6 +36,12 @@ defp cast_params(params) do
|
|||
limit: :integer
|
||||
}
|
||||
|
||||
params =
|
||||
Enum.reduce(params, %{}, fn
|
||||
{key, _value}, acc when is_atom(key) -> Map.drop(acc, [key])
|
||||
{key, value}, acc -> Map.put(acc, key, value)
|
||||
end)
|
||||
|
||||
changeset = cast({%{}, param_types}, params, Map.keys(param_types))
|
||||
changeset.changes
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue