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

3.0.7 and activeadmin 1.0.0pre broken #400

Closed
dshmelev opened this issue Jul 5, 2014 · 9 comments
Closed

3.0.7 and activeadmin 1.0.0pre broken #400

dshmelev opened this issue Jul 5, 2014 · 9 comments

Comments

@dshmelev
Copy link

dshmelev commented Jul 5, 2014

Hi!
Have a problem with 3.0.7 version (3.0.6 is good).
In case if I have more than one record in activeadmin tables my rails app crashed when load activeadmin controller. Logs:

2014-07-05T14:05:19.382623+00:00 app[web.1]: Started GET "/admin/" for 37.203.11.159 at 2014-07-05 14:05:19 +0000
2014-07-05T14:05:19.415267+00:00 app[web.1]:   Rendered vendor/bundle/ruby/2.1.0/bundler/gems/active_admin-2ae0a9e09bf9/app/views/active_admin/page/index.html.arb (23.6ms)
2014-07-05T14:05:19.416311+00:00 app[web.1]: cache: [GET /admin/] miss
2014-07-05T14:05:19.386066+00:00 app[web.1]: Processing by Admin::DashboardController#index as HTML
2014-07-05T14:05:19.415702+00:00 app[web.1]: Completed 200 OK in 29ms (Views: 24.5ms | ActiveRecord: 2.6ms)
2014-07-05T14:06:06.789199+00:00 heroku[router]: at=info method=GET path="/admin/site_properties" host=wish-s.herokuapp.com request_id=4e894a6a-ff29-4cc1-854d-a133b2eb57ab fwd="37.203.11.159" 
dyno=web.1 connect=2ms service=61ms status=500 bytes=1798
2014-07-05T14:06:06.734238+00:00 app[web.1]: Started GET "/admin/site_properties" for 37.203.11.159 at 2014-07-05 14:06:06 +0000
2014-07-05T14:06:06.774933+00:00 app[web.1]:   Rendered vendor/bundle/ruby/2.1.0/bundler/gems/active_admin-2ae0a9e09bf9/app/views/active_admin/resource/index.html.arb (31.7ms)
2014-07-05T14:06:06.775111+00:00 app[web.1]: Completed 500 Internal Server Error in 37ms
2014-07-05T14:06:06.782958+00:00 app[web.1]: 
2014-07-05T14:06:06.782965+00:00 app[web.1]: ActionView::Template::Error (wrong number of arguments (0 for 1)):
2014-07-05T14:06:06.782968+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0will_paginate (3.0.7) lib/will_paginate/active_record.rb:149:in `select_for_count'
2014-07-05T14:06:06.782967+00:00 app[web.1]:     1: insert_tag renderer_for(:index)
2014-07-05T14:06:06.782970+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0activerecord (4.1.1) lib/active_record/relation/calculations.rb:203:in `perform_calculation'
2014-07-05T14:06:06.782973+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0activerecord (4.1.1) lib/active_record/relation/calculations.rb:26:in `count'
2014-07-05T14:06:06.782971+00:00 app[web.1]:   vendor/bundle/ruby/2.1.0activerecord (4.1.1) lib/active_record/relation/calculations.r
@mislav
Copy link
Owner

mislav commented Jul 6, 2014

Thanks for reporting.

@edariedl Seems like Relation defines a select_for_count method that accepts no arguments. Thoughts?

Caused by: #372

@edariedl
Copy link
Contributor

edariedl commented Jul 8, 2014

Sorry, my fault. We probably should rename it in will_paginate.

@mislav
Copy link
Owner

mislav commented Jul 10, 2014

@edariedl Could you submit another PR, please? You have a much better idea of what's going on in that method than I do.

O-I added a commit to O-I/pluck that referenced this issue Jul 13, 2014
Apparently there is a naming conflict between Rails and will_paginate described here: mislav/will_paginate#400

I've patched will_paginate and will push to Heroku to see if this resolves my issue.
O-I added a commit to O-I/will_paginate that referenced this issue Jul 13, 2014
My issue seems to be independent of issue mislav#400 of will_paginate. Testing one more patch that changes the name and uses some slightly different code from nazgum's fork.
@edariedl
Copy link
Contributor

@mislav pull request which should fix this issue #401

@azul
Copy link

azul commented Sep 7, 2014

This is biting me too without active_admin. I'm not sure what is specific about the query that is triggering it. using 3.0.6 as a workaround for now.

azul added a commit to azul/crabgrass-core that referenced this issue Sep 7, 2014
3.0.7 introduced a ArgumentError: wrong number of arguments (0 for 1)

see  mislav/will_paginate#400
@voltechs
Copy link

voltechs commented Feb 1, 2017

Three years later, any resolution on this?

@mislav
Copy link
Owner

mislav commented Feb 2, 2017

@voltechs I don't think so! We need someone who: 1) explains exactly what's going on, 2) makes a fix, 3) provides a test that fails without the fix.

@winstonwolff
Copy link

@mislav — For (1) an explanation of what's going on, ActiveRecord defines a method

def select_for_count()

which takes no arguments, but WillPaginate also defines a method with that name and one argument that is mixed into ActiveRecord.

def select_for_count(rel)

The name collision causes things to break.

(2) This commit by @edariedl renames WillPaginate's version of the method to avoid the collision

(3) It will take me an hour or two to get everything setup to make a test that shows this problem. Could we just pull this commit in? In the same time, I could just switch to Kaminari.

@mislav
Copy link
Owner

mislav commented May 4, 2019

@mislav mislav closed this as completed May 4, 2019
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

6 participants