【发布时间】:2013-05-17 13:02:10
【问题描述】:
问题:是否可以在散列条件下测试连接表的属性是否大于/小于值
一个例子:测试演员年龄是否大于ageVariable:
-
是否可以写 而不是 ARRAY CONDITION:
ageVariable = 36<br> Movie.includes(:actors).where("actors.age > ?", ageVariable) -
哈希条件类似于:
ageVariable = 36 Movie.includes(:actors).where(:actors => { :age => COMPARE_LOGIC }) # Where COMPARE_LOGIC is something like: (:age > ageVariable)
【问题讨论】:
标签: activerecord hash compare conditional-statements where