Post

Once in a while I get too clever and make a context function that lets me dynamically do stuff like preload assocs, select specific fields, etc. only to realize I've rewritten a tiny subset of Ecto, on top of Ecto, for no discernable benefit. So... Sure, if it's early or very specific to a liveview

Makes sense! I'm trying to explicitly define when/why I move things to a context, which I usually do based on intuition. What are the non-ecto things we typically need to do? So far I've got: - Authorization - Compute/combine data - Extra filtering - Pagination - Caching Any others?

I'd add mutating records -- I think querying (read-only) records is fine to have more spread-about, but changing those records probably ought to funneled through a context module for consistency.

0 reposts1 like