pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 470 forks source link

undefined method on ThinkingSphinx::Search class. #1107

Closed geshwho closed 6 years ago

geshwho commented 6 years ago

I recently started seeing the following issue on a local development instance, and some newly built test environments. I've truncated the trace, but I can include the full backtrace if needed. The issue occurs with thinking-sphinx version 3.3.0 whenever attempting to load the application (rake tasks, console, starting server, etc.)

Bundler::GemRequireError: There was an error while trying to load the gem 'thinking-sphinx'.
Gem Load Error is: undefined method `!' for class `ThinkingSphinx::Search'
Did you mean?  !
               !=
               !~
Backtrace for gem load error is:
/home/circleci/idatainc/DataCookbook/vendor/bundle/ruby/2.3.0/gems/thinking-sphinx-3.3.0/lib/thinking_sphinx/search.rb:18:in `undef_method'
/home/circleci/idatainc/DataCookbook/vendor/bundle/ruby/2.3.0/gems/thinking-sphinx-3.3.0/lib/thinking_sphinx/search.rb:18:in `block in <class:Search>'
/home/circleci/idatainc/DataCookbook/vendor/bundle/ruby/2.3.0/gems/thinking-sphinx-3.3.0/lib/thinking_sphinx/search.rb:17:in `each'
/home/circleci/idatainc/DataCookbook/vendor/bundle/ruby/2.3.0/gems/thinking-sphinx-3.3.0/lib/thinking_sphinx/search.rb:17:in `<class:Search>'
pat commented 6 years ago

Hi Mangesh,

I think this is related to Ruby itself - it was a bug in 2.3.3 related to refinements, but fixed in 2.3.4, as discussed in #989. Are you in a position to upgrade Ruby in your app?

geshwho commented 6 years ago

Interesting.. I'll likely look into a workaround before considering an upgrade. As someone mentioned

It appears to be a problem with the shoulda-context gem which explains why I don't see the issue everywhere, all the time; We only use shoulda-context in test.

You can close this issue in the meantime, but I'll post an update if I happen to find a workaround if anyone else comes across this.