Hacker News new | past | comments | ask | show | jobs | submit login

Hi, author of the post here -- I actually skipped a few steps in this code, because it was getting quite long. As it turns out, ActiveRecord is amazingly complicated, even for the simplest of queries.

It's trying to build an AST for every query, and that AST uses Arel, which is its own, complex layer of abstraction. There are a lot of layers of turtles before you get to anything that looks like SQL.




Awhile ago I found a patch to Arel fixing up its support of unions, which I wanted to use, but it hadn't been merged and had fallen behind the version I was on. Fixing it up for the newer version required enough tweaking that I had to actually figure out how the code worked. I found it to be an impressively simple and well-written solution to an inherently complex problem.

All of this is to say that it would be neat to see this journey go even deeper!


Into Arel, you mean? Happy to do that. It would be a good opportunity to really understand that code better!


Yeah that's what I meant!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: