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

Link to this function

cast_with_upload(struct, params, permitted)

View Source

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: