【发布时间】:2019-01-12 12:58:58
【问题描述】:
Elixir 和 Phoenix 的新手。尽我所能。defmodule Countdown.Posts.Post do
use Ecto.Schema
import Ecto.Changeset
schema "posts" do
field :description, :string
field :image, Countdown.PostUploader.Type
field :shot, :naive_datetime
field :title, :string
timestamps()
end
@doc false
def changeset(post, attrs) do
post
|> cast(attrs, [:title, :shot, :description, :image])
|> cast_attachments(params, [:image])
|> validate_required([:title, :shot, :description, :image])
end
end
错误:
== 文件 lib/countdown/posts/post.ex 中的编译错误 == ** (CompileError) lib/countdown/posts/post.ex:19: 未定义函数 cast_attachments/3 (stdlib)lists.erl:1338::lists.foreach/2 (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6 (elixir) lib/kernel/parallel_compiler.ex:198: Kernel.ParallelCompiler.spawn_workers/6 中的匿名 fn/4
【问题讨论】:
标签: elixir image-uploading phoenix