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

undefined local variable or method `paginator' for _page.html.erb:22 partial #1074

Open
pmashchak-laborocity opened this issue Dec 15, 2021 · 2 comments

Comments

@pmashchak-laborocity
Copy link

Rails - 5.2.6
Kaminari - 1.2.1

Using ActiveAdmin with ActiveAdmin.register_page method and rendering partial

I want to customize pagination links
generated Kaminari default views into 'views/admin/kaminari/report'
Using this code
<%= paginate @users, views_prefix: 'admin', theme: 'report' %>

But getting this error, on

app/views/admin/kaminari/report/_page.html.erb:22:in

ActionView::Template::Error (undefined local variable or method `paginator' for #<#<Class:0x00007f82d00e1f28>:0x00007f82d00db1f0>
Did you mean?  paginate):
    19:     remote:        data-remote
    20:     paginator:     the paginator that renders the pagination tags inside
    21: -%>
    22: <%= paginator.render do -%>
    23:   <nav class="pagination">
    24:     <%= first_page_tag unless current_page.first? %>
    25:     <%= prev_page_tag unless current_page.first? %>
@krlosgilson
Copy link

In your action, did you call the .page method for the session variable?
For example: @users = User.all.page(params[:page])

@Emmy-github-webdev
Copy link

I have the same issue here. I am using Rails 7

blogs_controller.rb

def index
@blogs = Blog.page(params[:page]).per(5)
end

View

<%= render @blogs %> <%= paginate @blogs %>

I have alread add gem 'kaminari', '~> 1.2', '>= 1.2.2' to my Genfile and run bundle install

Error

ActionController::UnfilteredParameters in Blogs#index
Showing /home/emmy/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/kaminari-0.16.3/app/views/kaminari/_paginator.html.erb where line #14 raised:

unable to convert unpermitted parameters to hash

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

3 participants