📅  最后修改于: 2022-03-11 15:04:45.545000             🧑  作者: Mango
veg = Arel::Table.new(:vegetables)
query = veg[:created_at].gteq( 5.days.ago ).and(
veg[:color].eq("green").or(
veg[:gardener].eq("Susan")
)
)
query.to_sql
# "vegetables"."created_at" >= '2016-12-13 03:54:28.575342'
# AND ("vegetables"."color" = 'green' OR "vegetables"."gardener" = 'Susan')
Vegetable.where( query )