从这个输入: {'hearing' => 1} 我需要生成这个查询
Score.joins(:target_disability).where{ (target_disabilities.name == 'hearing') & (round(total_score) >= 1) }
从这个输入是 {'hearing' => 1, 'mobility' => 2},我需要生成这个:
Score.joins(:target_disability).where{ (target_disabilities.name == 'hearing') & (round(total_score) >= 1) | (target_disabilities.name == 'mobility') & (round(total_score) >= 2) }
等等...
这怎么能概括?因为我的输入有时有 3 或 4 个键...有时 1...