0

Here is the error:

NoMethodError - undefined method `current_page' for 30:Fixnum:
  kaminari (0.15.1) lib/kaminari/helpers/action_view_extension.rb:18:in `paginate'
   () home/funkdified/.rvm/gems/ruby-2.1.2@rails4.1/bundler/gems/spree-9d4617334c87/backend/app/views/spree/admin/zones/index.html.erb:13:in `_70ff2f2f2d783197075a15a1a88170b5'

Here is the problematic method

def paginate(scope, options = {}, &block)
  paginator = Kaminari::Helpers::Paginator.new self, options.reverse_merge(:current_page => scope.current_page, :total_pages => scope.total_pages, :per_page => scope.limit_value, :remote => false)
  paginator.to_s
end

I'm not too sure, but this may have something to do with having will_paginate in the same app. I have added this code in config/initializers:

if defined?(WillPaginate)
  module WillPaginate
    module ActiveRecord
      module RelationMethods
        def per(value = nil) per_page(value) end
        def total_count() count end
        def first_page?() self == first end
        def last_page?() self == last end
      end
    end
    module CollectionMethods
      alias_method :num_pages, :total_pages
    end
  end
end

And, I've also tried adding this:

Kaminari.configure do |config|
  config.page_method_name = :per_page_kaminari
end

Still no luck

infused
  • 24,000
  • 13
  • 68
  • 78
Abram
  • 39,950
  • 26
  • 134
  • 184

1 Answers1

1

Try adding

Spree::Product::ActiveRecord_Relation.include Kaminari::PageScopeMethods

to config/initializers/kaminari.rb

Vernon
  • 443
  • 4
  • 23