Enhancements
- Provide
Ecto.Model.build/2
andEcto.Model.assoc/2
for building and retrieving associations as queries. It is recommended toimport Ecto.Model
into your modules - Associations have been rewriten into a simpler and faster mechanism that does not require
.get
,.all
and friends - Add
Repo.preload/2
Ecto.Query.preload/3
now supports query joins to be given- Allow dynamic values for join qualifiers and join tables
- Define a behaviour named
Ecto.Associations
which defines the callback functions required to be implemented by associations
Backwards incompatible changes
- Association proxies have been removed. This means
post.comments
returnsEcto.Associations.NotLoaded
untilpost.comments
has been explicitly preloaded. However, once preloaded, the comments list can be accessed directly - Queryable implementation for associations has been removed. This means
Repo.all post.comments
no longer returns all comments. Instead useRepo.all Ecto.Model.assoc(post, :comments)
. It is recommended toimport Ecto.Model
into your modules join: p.comments
has been removed in favor ofjoin: assoc(p, :comments)
assoc/2
inselect
is deprecated, please useEcto.Query.preload/3
insteadEcto.Associations.Preloader.preload/3
was removed in favor ofRepo.preload/2