Elixir

Naming Phoenix context functions

In a Phoenix context we frequently need to create and update resources, using changesets. Each operation requires a function to get the changeset, and a function to perform the operation.

If the operation in question is "create", the standard approach is to name the changeset function create_changeset, but that's just confusing; am I getting a changeset for the "create" operation, or am I creating a generic changeset?

I prefer the following conventions.

Keep reading”Naming Phoenix context functions”

Sign up for my newsletter

A monthly round-up of blog posts, projects, and internet oddments.