質問

I want to use some sort of loop or iterator inside where statement like

Product.where{ array.each do |e|
  (id >= e[0]) & (id <= e[1])
end }

Is something like this possible?

In reality query is much more complicated, and I don't want to post whole architecture here.

役に立ちましたか?

解決

Product.where('id >= ? AND id <= ?',array[0],array[1])
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top