ruby on rails - Arel `between` with other columns as range -
it seems arel's between
predicate can used ranges only, eg
between(1.day.ago.time..time.current)
does know way use other columns? like
between(table[:since]..table[:till])
(the last not work shows idea). in end want
column between table.since , table.till
to generate table.field between another_table.from , another_table.to
use arel code:
arel::nodes::between.new( table[:field], arel::nodes::and.new( [ another_table[:from], another_table[:to] ] ) )
in case placed code .and()
arel method.
Comments
Post a Comment