I have one another question, about preload
Data struct in my table is the same:
Categories:
ID | parent_id | name | slug
1 / null / Electronic / electronic-1
2 / 1 / Phones / phones-2
3 / 2 / Accesories / accesories-3
In my example i want get all parrents (to up) categories from category of id 3 (accesories)
category = Repo.get(Category, 3) |> Repo.preload(:parent_category)
And i get parent_category only “one level up”
id: 3,
name: "Accesories"
slug: "accesories-3"
parrent_category: {
id: 2,
name: "Phones"
slug: "phones-2"
parent_category: #Ecto.Association.NotLoaded<association :parent_category is not loaded>, <- My problem - How i can load all assoc inside
}
Sorry about my english, if something is not correct, please tell me, i try write it different