Elixir ecto 2 create many_to_many association
问题 How can I make a many to many relation with ecto 2? As an example app I want to create a Post which can be in multiple categories. The categories already exist. For example: [%Category{id: "1", name: "elixir"}, %Category{id: "2", name: "erlang"}] Im using Ecto 2 beta 0. The example project is called Ecto2. I defined two models: defmodule Ecto2.Post do use Ecto2.Web, :model use Ecto.Schema schema "posts" do field :title, :string many_to_many :categories, Ecto2.Category, join_through: "posts