Wrapping Up
Ecto is a library for data mapping and database queries. It takes a different design approach than Ruby’s ActiveRecord library, but somehow it ends up feeling familiar. Many of the concepts and terms are similar between the libraries, so you’ll be right at home as you learn to use it. Ecto is used to query the database, translate data into your application, and change data from your application.
Ecto schemas are modules that define your application’s data structure. Ecto uses a schema to know how to map data from the database into an Elixir struct. You can define associations in your Ecto schema, such as one-to-one, one-to-many, and many-to-many associations. These associations are standardized across database libraries, so they feel ...
Get From Ruby to Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.