次のコードがあります。
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
これに何か利点はありますか?.where
現代よりも一般的なようですfind_all_by
。