Undefined method `/` for "":String using Kaminari and Rails 6

101 Views Asked by At

I have a rails 6.x JSON API where I am using Kaminari to paginate the results.

My code looks like this:

module PaginationHelper
  def paginate!(collection)
    collection.page(current_page).per(current_limit)
  end

  def current_page
    params[:page] || 1
  end

  def current_limit
    params[:limit] || 100
  end
end

class TestController < ApplicationController
  def index
    @collection = current_account.test_items
  end
end

The error in my view that I keep getting is:

"#<NoMethodError: undefined method `/' for \"\":String>"

"trace": "app/controllers/concerns/pagination_helper.rb:3:in `paginate!'"
0

There are 0 best solutions below