Created
December 31, 2020 20:57
-
-
Save FreedomBen/19bbe85182eefc03b0678b26ae0d1325 to your computer and use it in GitHub Desktop.
Part of my IEx config file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This module defines some handy functions for use in iex | |
# | |
defmodule DebugTools do | |
@doc ~S""" | |
Cast all the params provided here into an Ecto.Changeset. | |
This defeats Ecto's whitelist approach so you should never use this in real code! | |
It's intended as a debug tool for use in tests of IEx sessions. | |
""" | |
def ecto_cast_all(data, params, opts \\ []), | |
do: Ecto.Changeset.cast(data, params, Map.keys(params), opts) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment