Undefined method `per_page_kaminari` in history view when upgrading to Rails admin 3

47 views
Skip to first unread message

Maurizio Manetti

unread,
Jan 11, 2023, 10:45:06 AM1/11/23
to rails_admin

I am upgrading a working application from Rails 6 to Rails 7, as a consequence I am also upgrading Rails Admin to version 3.1.1 and PaperTrail to version 14.0.0.

In the Rails Admin interface the history view of tracked models now displays the error:

undefined method `per_page_kaminari' 

the name "per_page_kaminari" comes from the initializer at config/initializers/kaminari.rb introduced to avoid conflicts with will_paginate as suggested here:
https://github.com/railsadminteam/rails_admin/wiki/Troubleshoot#conflict-between-will_paginate-and-kaminari

However it looks the problem is at line 149 of rails_admin
rails_admin/extensions/paper_trail/auditing_adapter.rb
where the versions object does not seem to support anymore pagination. Commenting that line everything works, except not paginated.

Any idea?

Thanks a lot!


Maurizio Manetti

unread,
Jan 13, 2023, 10:03:38 AM1/13/23
to rails_admin
We replaced the initializer at config/initializers/kaminari.rb with another initializer with the following content:

```ruby
if defined?(WillPaginate)
  module WillPaginate
    module ActiveRecord
      module RelationMethods
        alias_method :per, :per_page
        alias_method :num_pages, :total_pages
      end
    end
  end
end
```

And things started working

Reply all
Reply to author
Forward
0 new messages