Current section

Files

Jump to
ami lib ami comment_attachment.ex
Raw

lib/ami/comment_attachment.ex

defmodule Ami.CommentAttachment do
use Ecto.Schema
use Arc.Ecto.Schema
import Ecto.{
Changeset
}
alias Ami.{
# Repo,
Comment
}
alias Ami.CommentAttachmentUploader.Type
schema "comment_attachments" do
field(:file_name, :string)
field(:file, Type)
belongs_to(:comment, Comment)
end
def changeset(struct, params \\ %{}) do
struct
|> cast(params, [:file_name, :comment_id])
|> cast_attachments(%{file: params.file}, [:file])
end
end