我有一个查询,
project.active.where("delivery_date <= :date", date: Date.today)
字符串
我不想使用这样的字符串
project.active.where(delivery_date: delivery_date <= Date.today)
型
但不工作,我得到了这个错误:
syntax error, unexpected ')', expecting `end'
型
我有一个查询,
project.active.where("delivery_date <= :date", date: Date.today)
字符串
我不想使用这样的字符串
project.active.where(delivery_date: delivery_date <= Date.today)
型
但不工作,我得到了这个错误:
syntax error, unexpected ')', expecting `end'
型
2条答案
按热度按时间ebdffaop1#
你可以使用
Arel
,但你在这里没有得到任何东西,如果有的话,它使它更难阅读:字符串
xxb16uws2#
字符串
或者Date.new可以替换为server/db的开头。你也可以这样做,但是这只是一个很长的范围。为什么你不想使用字符串呢?