说我有像这样的哈希
attributes = {"brown" => true, "black" => false, "rocky" => true, "pebbles" => false, "beige" => true, "white" => false, "red" => true, "pink" => "true" }
我有一个模型Beach
,我想查询哈希
Beach.where(attributes)
我相信这会将哈希属性与AND
子句brown is true AND black is false AND rocky = true.
我需要使用OR
条件brown is true OR black is false OR rocky is true
加入哈希属性。有任何想法吗?谢谢!