FactoryMan. Params
(Factory Man v0.5.0)
View Source
Utilities for converting Ecto structs to clean param maps.
These functions are used by the generated params_for_* and string_params_for_* factory
functions. You generally don't need to call them directly.
Summary
Functions
Recursively convert atom keys to string keys. Structs and other non-map values are left untouched.
Strip Ecto metadata from a struct, returning a plain map suitable for changesets or API tests.
Functions
Recursively convert atom keys to string keys. Structs and other non-map values are left untouched.
Strip Ecto metadata from a struct, returning a plain map suitable for changesets or API tests.
Specifically:
- Removes
__meta__and autogenerated IDs - Removes
belongs_toassociation structs (but sets FK if the association is persisted) - Recursively strips nested
has_one/has_manyassociations and embeds - Removes
Ecto.Association.NotLoadedvalues