Chapter 4Ecto and Changesets
Up to now, we’ve been focusing on our application’s presentation layer with views and templates, and controlling those views with controllers. Rather than bogging down into technical details, we used an application API to encapsulate all of our business concerns. Our single Accounts context keeps all the data directly in the code instead of using a real database. There’s a method to our madness. With very little work, we can now replace our in-memory data structures with a real database and all of our controller code can remain unchanged.
Ecto is the Elixir framework for persisting data. In this chapter, we’ll convert our Accounts context to use an Ecto repository backed by a PostgreSQL database. By the time you’re ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access