Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divergent method signature for "count". Will Paginate does not work with Rails 4.1.2rc1. #382

Closed
schneems opened this issue Jun 10, 2014 · 1 comment

Comments

@schneems
Copy link

We're using will_paginate on codetriage/codetriage and recently tried upgrading to Rails 4.1.2.rc1. While doing so we found there is an issue in the will_paginate method page_entries_info.

page_entries_info calls collection.size. The size method has been monkey patched but calls super which is defined in activerecord. The built in size method was changed in this commit: rails/rails@afd4d82

So that count is called with an argument :all. Unfortunately count is also overwritten by will_paginate and it does not have the same method signature, so it fails.

Here's the backtrace:

wrong number of arguments (1 for 0)
will_paginate (3.0.5) lib/will_paginate/active_record.rb:81:in `count'
activerecord (4.1.2.rc1) lib/active_record/relation.rb:241:in `size'
will_paginate (3.0.5) lib/will_paginate/active_record.rb:97:in `size'
will_paginate (3.0.5) lib/will_paginate/view_helpers.rb:128:in `page_entries_info'

I found this while investigating rails/rails#15430, though the issues seem to be unrelated.

prathamesh-sonpatki added a commit to codetriage/CodeTriage that referenced this issue Jun 10, 2014
prathamesh-sonpatki added a commit to codetriage/CodeTriage that referenced this issue Jun 14, 2014
@mislav mislav closed this as completed in 0c6d08e Jun 18, 2014
@schneems
Copy link
Author

Thanks ❤️

prathamesh-sonpatki added a commit to codetriage/CodeTriage that referenced this issue Jun 27, 2014
mislav added a commit that referenced this issue Jun 28, 2014
prathamesh-sonpatki added a commit to codetriage/CodeTriage that referenced this issue Jul 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant