0
我有一個簡單的Phoenix Channel來處理消息的websockets。我嘗試添加一個模型到數據庫中的插入,當我在傳遞這些消息PARAMS正在此錯誤。Phoenix - (ErlangError)erlang錯誤:「模塊無法加載」
def handle_in("new:msg", msg, socket) do
message_params = %{"body" => msg["body"]}
changeset = Message.changeset(%Message{}, message_params)
case Repo.insert(changeset) do
{:ok, room} ->
broadcast! socket, "new:msg", %{user: msg["user"], body: msg["body"]}
{:reply, {:ok, %{msg: msg["body"]}}, assign(socket, :user, msg["user"])}
{:error, changeset} ->
end
end
這裏的錯誤。關於這可能是什麼的任何想法都非常值得歡迎。
Repo.insert(%Ecto.Changeset{action: nil, changes: %{body: "feaflje"}, constraints: [], errors: [], filters: %{}, model: %PulseApi.Message{__meta__: #Ecto.Schema.Metadata<:built>, body: nil, id: nil, inserted_at: nil, room: #Ecto.Association.NotLoaded<association :room is not loaded>, room_id: nil, updated_at: nil}, optional: [], opts: [], params: %{"body" => "feaflje"}, repo: nil, required: [:body], types: %{body: :string, id: :id, inserted_at: Ecto.DateTime, room_id: :id, updated_at: Ecto.DateTime}, valid?: true, validations: []})