Below you will find pages that utilize the taxonomy term “tutorial”
Posts
Updating deeply nested elixir maps
In some cases it is necessary to update a deeply nested attribute in a map. I went searching for a way to do this and came across several approaches, the one that worked for me was this, a combination of Kernel.put_in and Access.key, here I’m using it to update a socket struct nested assigns map.
put_in(socket, Enum.map([:assigns, :beacon_live_data, :form_submitted], &Access.key(&1, %{})), true) The put_in function is pretty easy to understand, it Puts a value in a nested structure via the given path.
Posts
Running Quantum in an Elixir Cluster
In one of the projects that I work on, for the sake of availability and reliability, we are running our Phoenix app in a cluster of 3 servers using libcluster. Initially, it was just running on a single server and I had configured Quantum to run our recurring tasks on a cron like schedule. This worked well, and I had no issues with the setup. When we decided to move to a clustered setup, there was a consideration concerning Quantum.
Posts
Add Sass to Phoenix 1.6 with Esbuild
If you are starting a new project with The Phoenix Framework version 1.6, you’ll notice there has been a change with regard to asset handling. Chris McCord and The Phoenix Team have made the choice to move away from WebPack and start using Esbuild to deal with the Javascript files. One side effect of this is you lose the ability to use Sass files by default. Have no fear, there’s a way to add Sass back into your project.