3 ms·
It is more flexible, but often that flexibility is not necessary. I replied in more detail to the sibling answer but in the Ecto version of this sample query, d
by pmontra 9y ago
It is more flexible, but often that flexibility is not necessary. I replied in more detail to the sibling answer but in the Ecto version of this sample query, don't I have to write the definition of actual and by_email? AR gives me by_email for free. Instead, actual would be a scope and I have to write that code with AR too.
- out_of_protocol 9y agoExactly the same: Repo.get_by(Post, title: "My post") https://hexdocs.pm/ecto/Ecto.Repo.html#c:get_by/3 https://hexdocs.pm/ecto/Ecto.Repo.html#c:get_by/3 (Rails/AR deprecated find_by_xxx methods, promotes find_by() instead - for performance reasons)