Many to Many
# from MyApp.Post
many_to_many :tags, MyApp.Tag, join_through: "posts_tags"
#is backed by relational databases through a join table as follows:
[Post] <-> [posts_tags] <-> [Tag]
id <-- post_id
tag_id --> idStep by Step Guide
create table("todo_lists") do
add :title
timestamps()
end
create table("todo_items") do
add :description
timestamps()
end
create table("todo_list_x_items", primary_key: false) do
add :todo_item_id, references(:todo_items)
add :todo_list_id, references(:todo_lists)
#timestamps()
endLast updated