ActiveStorage (active_storage v0.0.1)

The ActiveStorage context.

Link to this section Summary

Link to this section Functions

Link to this function

attached?(record, attachment_name)

Checks if attachment(s) exists (works for has_one_attached and has_many_attached).

Examples

iex> attached?(user, "avatar")
true
Link to this function

change_storage_blob(storage_blob, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking storage_blob changes.

Examples

iex> change_storage_blob(storage_blob)
%Ecto.Changeset{data: %Blob{}}
Link to this function

content_types_allowed_inline()

Link to this function

content_types_to_serve_as_binary()

Link to this function

create_direct_upload(map)

Link to this function

create_storage_blob(attrs \\ %{})

Creates a storage_blob.

Examples

iex> create_storage_blob(%{field: value})
{:ok, %Blob{}}

iex> create_storage_blob(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

delete_storage_blob(storage_blob)

Deletes a storage_blob.

Examples

iex> delete_storage_blob(storage_blob)
{:ok, %Blob{}}

iex> delete_storage_blob(storage_blob)
{:error, %Ecto.Changeset{}}
Link to this function

get_attachment(record, attachment_name)

Gets a record's attachment.

Returns nil if attachment doesn't exist.

Examples

iex> get_attachment(user, "avatar")
%ActiveStorage.Attachment{}
Link to this function

get_attachments(record, attachment_name)

Link to this function

get_storage_blob!(id)

Gets a single storage_blob.

Raises Ecto.NoResultsError if the Storage blob does not exist.

Examples

iex> get_storage_blob!(123)
%Blob{}

iex> get_storage_blob!(456)
** (Ecto.NoResultsError)
Link to this function

graphql_resolver(a, map1, map2)

Link to this function

list_storage_blob()

Returns the list of storage_blob.

Examples

iex> list_storage_blob()
[%Blob{}, ...]
Link to this function

service_url(blob)

Link to this function

update_storage_blob(storage_blob, attrs)

Updates a storage_blob.

Examples

iex> update_storage_blob(storage_blob, %{field: new_value})
{:ok, %Blob{}}

iex> update_storage_blob(storage_blob, %{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

variable_content_types()

Link to this function

web_image_content_types()