I have the following schemas
schema "wishlists" do
belongs_to(:user, User)
many_to_many(:products, Product, join_through: ProductWishlist)
timestamps()
end
schema "products" do
...
many_to_many(:wishlists, Wishlist, join_through: ProductWishlist)
timestamps()
end
schema "products_wishlists" do
belongs_to(:product, Product)
belongs_to(:wishlist, Wishlist)
many_to_many(:filters, ProductFilter, join_through: ProductFilterWishlist)
timestamps()
end
@primary_key false
schema "products_filters_wishlists" do
belongs_to(:products_filters, ProductFilter, foreign_key: :product_filter_id)
belongs_to(:products_wishlists, ProductWishlist, foreign_key: :product_wishlist_id)
field(:quantity, :integer)
timestamps()
end
can I somehow preload the filters
from products_wishlist
?
something like (incorrect code following:
Repo.get!(Wishlist, id)
|> Repo.preload(:filters) <-------