【问题标题】:Ecto add many_to_many with extra fieldsEcto 添加带有额外字段的 many_to_many
【发布时间】:2017-12-14 03:50:11
【问题描述】:

我按照这条指令http://blog.roundingpegs.com/an-example-of-many-to-many-associations-in-ecto-and-phoenix/ 创建了一个many_to_many 关联。但我需要 many_to_many 表中的一些字段。在我的情况下,users_organizations 需要 left 和 join_at 等字段。所以我需要为我的 users_organizations 添加一个带有额外字段的模型。但是如何与他们合作?创建组织 -> 使用额外字段创建 users_organization 并将其与 put_assoc 一起放入组织?有没有人有这个案例的例子或者可以告诉我我的方法是否正确?

谢谢

【问题讨论】:

    标签: many-to-many elixir ecto


    【解决方案1】:

    似乎 Ectos many_to_many api 不支持额外的字段。在这里找到它:https://elixirforum.com/t/many-to-many-association-table-with-extra-columns/6563/4 感谢您的反对;)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-03
      • 1970-01-01
      • 2015-08-26
      • 1970-01-01
      • 1970-01-01
      • 2016-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多