-
Notifications
You must be signed in to change notification settings - Fork 808
Closed
Labels
Description
This is related to #382
Using the code from master, I'm trying to make a MultiModel Search:
(Elasticsearch::Model.search('search term', [User, Admin]).page(params[:page]).records
)
And that works fine, however, when trying to use Kaminari's paginate
helper with the records collection, I'm getting the following error:
NameError - undefined local variable or method `max_pages' for #<Elasticsearch::Model::Response::Records:0x007f99cd59b258>:
() .../bundler/gems/elasticsearch-rails-ded203569208/elasticsearch-model/lib/elasticsearch/model/response/records.rb:58:in `method_missing'
kaminari (0.16.3) lib/kaminari/models/page_scope_methods.rb:27:in `total_pages'
kaminari (0.16.3) lib/kaminari/helpers/action_view_extension.rb:18:in `paginate'
I noticed that the Kaminari configuration methods are getting included in Elasticsearch::Model::Response::Results
but not on Elasticsearch::Model::Response::Records
(see model/response/pagination.rb), so including the Kaminari methods in Elasticsearch::Model::Response::Records
fixes my issue.
Is there a reason why those methods don't get included in Elasticsearch::Model::Records
?