A use-case for virtual fields in Ecto
Ever wanted to show a list of items along with the number of another related item, e.g. show a list of posts with the number of comments?
We can use Ecto virtual fields to achieve this.
Consider a schema defined as:
schema "posts" do
# ...
has_ma...
en.vfsoraki.ir3 min read