我正在尝试使用 AREL 构建 where 子句,但这不会执行查询:
rec = self.where('color' => color_passed)
rec = rec.where('make' => make_passed) if make_passed.present?
rec = rec.where('year' => year_passed) if year_passed.present?
如何根据某些条件正确附加 where 条件?
我正在尝试使用 AREL 构建 where 子句,但这不会执行查询:
rec = self.where('color' => color_passed)
rec = rec.where('make' => make_passed) if make_passed.present?
rec = rec.where('year' => year_passed) if year_passed.present?
如何根据某些条件正确附加 where 条件?