Tag: 动态查找器

Rails“find_all_by”vs“.where”

我有以下代码: def maturities InfoItem.find_all_by_work_order(self.work_order).map(&:maturity) end 我正考虑将其更改为: def maturities InfoItem.where(work_order: self.work_order).map(&:maturity) end 这有什么好处吗? 看起来像。现在比find_all_by更常见。