Add Imports and Aliases
Explore how to optimize your IEx environment for Ecto by adding imports and aliases. Learn to efficiently access common modules such as Repo, Ecto.Query, and Ecto.Changeset. This lesson helps you save keystrokes and simplify your workflow when writing queries and making data changes in Elixir.
We'll cover the following...
We'll cover the following...
Add aliases
One of the most valuable things we can do is add aliases for the modules we work with often. We’ll most likely want to start with Repo and most (if not all) of our schema modules. For the MusicDB application, we might do the following:
This one addition means that instead of typing this:
We can type this:
Those saved keystrokes start to add up after a while. ...