I have always found ActiveRecord to be extremely limiting, and Sequel to be
much better. Some random limitations I have had to deal with over the years (in no particular order):
* No support for "OR" statements, without dropping down to raw SQL (I think this was added in either Rails 4, or Rails 5)
* Terrible support (if any) for more advanced PostgreSQL features, such as CTEs, bigserial (Rails 5 finally supports this if I'm not mistaken), no proper support for composite primary keys, no support for PostgreSQL CHECK constraints, no support for index expressions (e.g. an index on `lower(foo)`), etc. For GitLab we had to add many hacks to work around this.
* A rather messy model API, where models are used as both repositories and objects representing single rows. Sequel makes the same mistake with its ORM, but at least you can use the query toolkit separately. ROM supposedly does this better, but I have not tried it.
* Too many methods are injected into your classes, and you'll probably never use most of these (this is a more philosophical issue, and certainly not a deal breaker).
There are plenty more, but these are the ones that come to mind. My biggest issue in recent times was caused by ActiveRecord/Arel silently throwing away CTEs used in UPDATEs. Basically in GitLab we did something like this (I don't fully remember what the query was):
WITH foo AS ( ... )
UPDATE some_table
SET a = b
WHERE x = foo.y
In other words: we'd grab some data using a (recursive) CTE, then update a bunch of rows based on that data. Unfortunately, ActiveRecord/Arel would throw away the CTE in certain cases. This would result in us effectively running the following:
UPDATE some_table
SET a = b
You can imagine the fun of having to deal with all rows being updated unexpectedly. More details on this particular bug can be found here:
https://gitlab.com/gitlab-org/gitlab-ce/issues/37916Long story short, I'm fairly convinced that using Sequel would have made GitLab's database code much more solid/less buggy than it is today, simply because it supports so much more (and better) out of the box.