Is there any way to do cleanly in Arel and/or ActiveRecord::Relation,
A complex OR clause
I am aware of:
t = A.arel_table (A === model, “as” = table)
but am looking for a case where I want to write something more
complex (multiple tables) like:
some relation: r1 = A.includes(:lots of
r2 = A.includes(:lots of stuff).where(…).where(…)
and I want r1.or.r2 , or, written: r1 | r2 …
exactly like r1.merge(r2) or r1 & r2 for an AND chain…
Doing a group clause on, for example, r2 above, where the grouping is
done by a specific column (e.g. :item), but the item column comes from
r1, not r2, and is linked together using another column (e.g.
That is, something like (writing pseudo Arel-like code):
… is that possible/close?