I recently rewrote a service that was on AWS API Gateway and Lambda in Elixir and apparently that intrigued some…
I’m working on a small PR for an open source project and I needed to figure out if a function supported a specific arity from the format {module, function} .
{module, function}
I’m not sure if I missed something going through the ja_serializer README, but I couldn’t find a consistent way to render JSONAPI errors.
I tossed together this fallback controller for ja_serializer using action_fallback that will…
ja_serializer
action_fallback
Avoiding N+1 queries with Ecto is easy using preload/3 but I frequenty find that I need to preload a subset of an association. It turns out that there is a little magic 2 element tuple syntax that supports this.
preload/3
I’ve been doing a lot of work with really large Ecto.Multi’s for a data project I’m working on and I frequently find that I want to pry in the middle of a bunch of functions to see whats going on…
pry
TLDR; If the thing exists, use put_assoc. If you’re creating it, use cast_assoc.
Ecto has two nifty methods for working with associated records in a changeset.
I was working with implementing a closure tree for replies on a comments table the other day and needed a way to represent the “parent” comment for rendering on the front end.