Current section

Files

Jump to
ami lib ami post_attachment.ex
Raw

lib/ami/post_attachment.ex

defmodule Ami.PostAttachment do
use Ecto.Schema
use Arc.Ecto.Schema
import Ecto.{
Changeset
}
alias Ami.{
# Repo,
Post
}
alias Ami.PostAttachmentUploader.Type
schema "post_attachments" do
field(:file_name, :string)
field(:file, Type)
belongs_to(:post, Post)
end
def changeset(struct, params \\ %{}) do
struct
|> cast(params, [:file_name, :post_id])
|> cast_attachments(%{file: params.file}, [:file])
end
end