Uploader v0.1.0 Uploader.Ecto.Changeset View Source
Link to this section Summary
Functions
Returns a changeset for the given struct
(see Ecto.Changeset.cast/4
).
Link to this section Functions
Returns a changeset for the given struct
(see Ecto.Changeset.cast/4
).
Casts file uploads (Plug.Upload
structs) into a generated UUID filename or, if the
:cast
option is present, into a value obtained by a call to the user-defined
cast function.
In order not to lose the Plug.Upload
structs after casting, these structs are
stored into virtual fields named by the original fields that held the file uploads
prefixed by "uploaded_".
Example:
- A param named "image" contains a file upload (
Plug.Upload
struct); cast_with_upload/3
casts thePlug.Upload
struct into a filename;- the changeset field :image contains the filename;
- the changeset field :uploaded_image contains the
Plug.Upload
struct.