Placing schemas inside contexts makes it difficult to distinguish between data and actions. Let's fix that.
Phoenix is a web framework developed in the Elixir programming language, designed for high-concurrency and real-time applications. It’s less batteries-included than Rails or Laravel but still has all of the essential features a modern web application requires.
The Ecto library, responsible for data validation and persistence, is a functional take on a traditional ORM. It’s a breath of fresh air for anyone accustomed to dealing with the vagaries of active record approaches, such as Laravel’s Eloquent.
The following articles delve into the practical realities of working with the Phoenix ecosystem. They’re a great way to delve deeper if you’ve already mastered the basics.
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.
Sign up for my newsletter
A monthly round-up of blog posts, projects, and internet oddments.