We've moved discussions to Discord

Undefined method `per' for #<TeamMember::ActiveRecord_Relation ... and all other dashboard/models [UPDATED/SOLVED]

Darren Smyth
Hi

I'm trying to access models from the dashboard. I've not needed to do this for a while, but have now come across a problem when trying to access ANY dashboard:

undefined method `per' for #<TeamMember::ActiveRecord_Relation:

Some of the stack trace says:

Application Trace | Framework Trace | Full Traceactiverecord (6.0.0) lib/active_record/relation/delegation.rb:108:in `method_missing'
administrate (c664b5d6f1c8) app/controllers/administrate/application_controller.rb:12:in `index'
actionpack (6.0.0) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.0.0) lib/abstract_controller/base.rb:196:in `process_action'
actionpack (6.0.0) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.0.0) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.0.0) lib/active_support/callbacks.rb:135:in `run_callbacks'
actionpack (6.0.0) lib/abstract_controller/callbacks.rb:41:in `process_action'

When I look at the administrate/application_controller.rb:12

resources = resources.page(params[:page]).per(records_per_page)

I am unsure if this is something I have done.

Do you have any ideas as to why none of the bashboards will be loading? This includes the ones which set up with jumpstart.
Darren Smyth
Further to this, I have just checked out and tested previous versions from git and, before I merged the latest jumpstart changes from gitlab it was all working well.

Testing the version after the changes and I am getting the errors shown above.

Does this mean something isn't quite right in the state of Denmark in the administrate gem?

Just trying to help sort the problem!
Darren Smyth
I have since worked out that installing the simple_discussion gem caused a conflict somewhere (perhaps with will_paginate?) so have deleted the gem and all works. Shame really ... as I really liked the simple_discussion gem  Chris Oliver   (except for the fact it used Bootstrap and not tailwind).
I have just come across the same issue. Is there a way to allow will_paginate to play nicely with kaminari / administrate?
for anyone that comes across this issue, the solution that works for me is https://stackoverflow.com/questions/14958438/rails-activeadmin-undefined-method-per-for-activerecordrelation0x4d15ee#15134941
Notifications
You’re not receiving notifications from this thread.