啊抱歉,也许我只看到它是因为我在本地运行它。试试这个:
MethodProfiler.output_sql_to_stderr! Report.find("posts", start_date: 4.weeks.ago, end_date: Time.zone.now).data
现在你会看到很多查询的噪音,但最后的几个查询将是报告中的查询: