I’d have one question. Is there an Arel guide planned?
I found Arel quite undocumented, I had to search a bit to find some stackoverflow discussions (but just once I luckily discovered that something like this exists), blog entries or presentations, when I think this topic is so important that it should have it’s own guide so that anyone new to Rails could get easily started with it (or at least he/she could notice that something like this is available).
Arel is mentioned on the ActiveRecord Query Interface page, but it’s only one use-case without any further explanation.
If no guide is planned, then I’d suggest that at least a short introduction could be added to the RoR guides, listing some useful links where more information could be found.
I find this topic very important, because I have seen other libraries (in other frameworks) enabling describing complex business-related queries in a very elegant and efficient way, and till now I thought this is not existent in Rails.
Arel is kind of a gray area, but you have to think Arel is private
interface. Active Record uses Arel but that library could in theory be
replaced tomorrow and nobody should notice.
Solutions using Arel as a DSL to build SQL are using sorta private
interface. The public interface is the one in Active Record.
Well that's a surprise and disappointment to me. There have been many devs touting the virtues of arel in blogs and railscasts. It's even mentioned in the railsguides themselves (albeit in a cursory way). How does one know that an interface should be regarded as "sorta private"? Is sorta_private a new Ruby directive? Couldn't it be a hidden gem that nobody thought to document? I'm curious how such a decision is made and communicated?
Pratik Naik was who redesigned the AR API to use a gem like that, and
he was who decided that he was exposing a new API, with whatever
backend he chose. The backend is private and can be replaced.
So that explains why the API is at the Active Record level, and that
is what the documentation covers intentionally. And also that explains
the answer to the original question.