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

index not working with Ruby 3 #1007

Open
Sirius-KiH opened this issue Sep 12, 2021 · 4 comments
Open

index not working with Ruby 3 #1007

Sirius-KiH opened this issue Sep 12, 2021 · 4 comments

Comments

@Sirius-KiH
Copy link

After updating to Ruby 3, calling Post.index throws an error:

ArgumentError: wrong number of arguments (given 1, expected 0)
/usr/local/bundle/gems/activerecord-6.0.4.1/lib/active_record/relation/batches.rb:126:in `find_in_batches'
/usr/local/bundle/gems/sunspot_rails-2.5.0/lib/sunspot/rails/searchable.rb:267:in `solr_index'
/kih/lib/tasks/kih.rake:188:in `posts_post_processing'

Potentially related issue with more info: doorkeeper-gem/doorkeeper#1467

@mmchavda
Copy link

mmchavda commented Oct 13, 2021

hi Sirius-KiH ,

Did you find any solution?
same issue generate with reindex command after updating to ruby 3: bundle exec rake sunspot:solr:reindex[,User]

As per my console trace issue is with the "def solr_index" when find_in_batches function execute line: self.includes(options[:include]).find_in_batches(options.slice(:batch_size, :start)) do |records|

I think some change required here in arguments:

@Sirius-KiH
Copy link
Author

Hey, sorry for not updating.

Turns out that this is already fixed in master, though not in any official release yet. I solved the problem by installing the gem directly from git:

# Gemfile
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem 'sunspot_rails', github: 'sunspot/sunspot', glob: 'sunspot_rails/*.gemspec'

@mmchavda
Copy link

sunspot

Thanks, i hope soon they will provide release to include stable version.

@alexdunae
Copy link

This should be closed now since c4e8af6 is part of the 2.6 gem release.

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