Is there any way to describe the following relationship, such that you could write
sale.item.price, where item might be a red OR green item?
I can’t figure a great way to model it in ecto, but I also don’t think it’s such an unusual setup that it would not have a solution somehow?
I tried passing in a Ecto.Query at a stretch, thinking it might pass as a queryable but no luck.
One solution is just having an “items” table, a “kind” field on it, and multiple schemas that point to the one table with different fields.
I think maybe I have to define that center table as an actual type to work on, inferring the item type by its data.
Or I guess people just write a function on Sale (or Sales context), with some huge join?