Add Helper Functions
Explore how to create helper functions within IEx to streamline Ecto database operations such as updating records and preloading associations. Understand where and why to place these helpers, and how they can speed up development without introducing risks in production environments.
Learning how to add imports and aliases is a good start, but remember that .iex.exs is just a regular Elixir file, so we can define modules and functions as well. Consider the example we were just discussing, which was making a change to a record in the database. Normally, this process requires a few steps, but we can create a helper function that will handle most of the boilerplate.
Where to put IEx helper functions?
We usually like to put our IEx ...