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

current_page Method Missing After Upgrading meilisearch-rails #394

Closed
dlackty opened this issue Feb 10, 2025 · 3 comments · Fixed by #395
Closed

current_page Method Missing After Upgrading meilisearch-rails #394

dlackty opened this issue Feb 10, 2025 · 3 comments · Fixed by #395

Comments

@dlackty
Copy link

dlackty commented Feb 10, 2025

Description
After upgrading to the latest version (0.41.2) of meilisearch-rails, the current_page method is no longer available on the search result object when using Kaminari pagination. I downgraded to 0.41.1 and it works again. Related #376

Expected behavior
Calling .current_page on the search results should return the current page number.

Current behavior
Calling .current_page results in a NoMethodError:

Screenshots or Logs

talks = Talk.search(query_term, hits_per_page: 10, page: page)
talks.count 
# => 1
talks.current_page
# => NoMethodError: undefined method `current_page' for [#<Talk id: 1111>]:MeiliSearch::Rails::Pagination::Kaminari (NoMethodError)

Environment (please complete the following information):

  • OS: macOS
  • Meilisearch server version: 1.4.0
  • meilisearch-rails version: 0.41.2
  • Rails version: 6.1.7.10
@ellnix
Copy link
Collaborator

ellnix commented Feb 10, 2025

Thank you for your report!

I believe I can see why this is happening, I should have been more careful reviewing that PR...

Expect a fix in less than an hour.

@ellnix
Copy link
Collaborator

ellnix commented Feb 10, 2025

This is the relevant code in Kaminari: https://github.com/kaminari/kaminari/blob/f96e022d0d7540c2e6455debb7992a9a6244a9cb/kaminari-core/lib/kaminari/models/array_extension.rb#L21

This was happening due to the limit not being set properly.

@dlackty
Copy link
Author

dlackty commented Feb 11, 2025

I just gave #395 a try and can confirm that it fixes the issue.

pozelli pushed a commit to pozelli/meilisearch-rails that referenced this issue Mar 6, 2025
meili-bors bot added a commit that referenced this issue Mar 7, 2025
395: Properly set `limit` in Kaminari r=ellnix a=ellnix

Fixes regression in #376
Fixes #394

Co-authored-by: ellnix <[email protected]>
@meili-bors meili-bors bot closed this as completed in 0e06892 Mar 7, 2025
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

Successfully merging a pull request may close this issue.

2 participants