我正在将我的 rails 应用程序在 ruby 1.9.3 上从 2.3.5 升级到 3.2.5。在旧应用程序中,我使用了 will_paginate 插件,我已将其转换为 gem。
现在升级后我收到以下错误:参数数量错误(2 比 1)
应用程序跟踪中的几行:Application Trace | 框架跟踪 | 全跟踪
will_paginate (3.0.3) lib/will_paginate/active_record.rb:124:in `paginate'
app/models/activity.rb:28:in `dashboard_activities'
app/controllers/dashboard_controller.rb:10:in `index'
actionpack (3.2.5) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.5) l
我相信问题出在我正在使用分页的活动模型中的旧代码中。任何人都可以帮忙吗?
编码:
def dashboard_activities(page, total_records, date_range1 = nil, date_range2 = nil )
unless date_range2.nil?
x =[ "is_delete = false AND status = 'open' AND date(due_date) between ? and ?", date_range1, date_range2]
else
x =[ "is_delete = false AND status = 'open' AND date(due_date) = ? ", date_range1]
end
paginate(:all,
:page =>page,
:per_page =>total_records,
:conditions => x,
:order =>"due_date asc")
end