这就是我想写的。在rails控制台中编写它的最佳方法是什么?

时间:2016-08-01 22:43:56

标签: ruby-on-rails

models = Model.joins("inner join manufs_models on manufs_models.manuf_id = 3 or manufs_models.manuf_id = 5 or manufs_models.manuf_id = 9 or manufs_models.manuf_id = 10")

我怎样才能简明扼要地写出来?

1 个答案:

答案 0 :(得分:1)

这更简洁:

models = Model.joins("inner join manufs_models on manufs_models.manuf_id IN (3,5,9,10)")