我需要向原始sql查询传递一个ids数组,如下所示:真正的查询包含许多联接和聚合函数,不能使用Arel我不想将ids插入到字符串中,而是使用这样的绑定变量(伪代码):
ActiveRecord::Base.connection.select_all("select offers.* from offerswhere id in (:ids)", {ids: [1,
我有一个I数组,我希望使用活动记录查询从数据库中找到它们各自的记录。例如:ids = [2, 3, 1]Model.find_all_by_id([2, 3,1])These methods were deprecated on 4.0 and removed at 4.1.If you want to
keep sing then you need to inc