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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -