在Ecto中查询嵌入式模式

时间:2018-09-24 12:17:19

标签: postgresql elixir ecto jsonb

我编写了以下查询:

MyApp.Repo.all(from a in MyApp.Assignment, join: c0 in assoc(a, :client), join: c1 in assoc(c0, :company_detail), where: c1.holding_company == "Sample", select: a)

我收到此错误could not find association` company_detail` on schema MyApp.Client

:company_detail是一种以以下方式与:client相关的嵌入式架构:

defmodule MyApp.Client do
  use MyApp.Web, :model
  use Arc.Ecto.Schema
  schema "clients" do
   embeds_one(:company_details, MyApp.CompanyDetail, on_replace: :delete)
  end
end

0 个答案:

没有答案