Rails 3 upgrade will_pagination wrong number of arguments (2 for 1)
Posted
by
user1452541
on Stack Overflow
See other posts from Stack Overflow
or by user1452541
Published on 2012-06-24T03:18:43Z
Indexed on
2012/06/25
21:16 UTC
Read the original article
Hit count: 135
I am in the process of upgrading my rails app from 2.3.5 to 3.2.5 on ruby 1.9.3. In the old app I was using the will_paginate plugin, which I have converted to a gem.
Now after the upgrade I am getting the following error : wrong number of arguments (2 for 1)
A few lines from application trace: Application Trace | Framework Trace | Full 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
I believe the issue is in the old code in the activity Model where I am using pagination. Can anyone help?
The code:
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
© Stack Overflow or respective owner