我在使用地图的地方有以下内容:
last_activities = report.deals.map do |deal|
deal.activities.last
end
然后我希望能够在“last_activities”上使用“where”,但我不能这样做,因为 last_activities 是一个数组。我想做但不能做的是:
fun_activities = last_activities.where(:type => "fun")
我怎样才能在rails中完成这个?
更新:
报告 has_many 交易
Deal belongs_to 报告
Deal has_many 活动
Activity belongs_to deal