Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Having worked for years with both Ecto and Ruby's ActiveRecord I really prefer ActiveRecord. It's less flexible but so much easier to use. Ecto is somewhat closer to SQL and still suffers from the "I have to relearn how to do SQL in yet another language" syndrome and it's a particularly difficult case of it. A lot of boilerplate to represent database tables and a lot of not obvious code to do easy queries. Definitely the part of Elixir I like less, by a large margin. Ecto and the deployment system are what stop me from using Elixir in my personal projects.


I have a huge dislike to ActiveRecord because its high abuse rate.

Beginners will most certainly will have highly inefficient start with it.

There are others in Ruby world which needs more praise such as Sequel and ROM(which is what Hanami uses also).

With Rails having the monopoly and most gems having AR as dependency, it's hard to see where we will go regarding ORMs in Ruby world.


I can definitely see where this criticism comes from. There is a lot of extra data description, and an abstraction that leans towards SQL.

However, that "boilerplate" makes data access and return values super clear. It also allows you to segregate Ecto queries by domain, meaning in a User context you may only have access to certain fields, whereas in a data processing context other fields may be available. This is great for coarse table access control, and you get it almost for free. It also allows you to very easily validate data at the edges of the system.

As for the query language, I can say for sure that there's a learning curve but it's close enough that your 1st guess is usually correct in my experience, and it removes a lot of foot guns like n+1 queries by default.

TL;DR there's some learning curve and extra LOC to write, but you get a lot in return.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: