0

While running bundle install trying to update some other gem, Thinking Sphinx was updated to version 3.0.5 from 3.0.3.

I now get the following error on Heroku:

Mysql2::Error: Can't connect to MySQL server on '127.0.0.1' (111)

Sphinx works fine locally, but any searches on Heroku result in this error. Of course, on Heroku it should not be attempting to connect to localhot but rather to the Sphinx add-on.

What changed in version 3.0.5 and how can I fix it?

Also, how can I protect my app against these kinds of things without staing forever in version 3.0.3?

4

1 回答 1

0

这个答案的所有功劳归功于 Thinking Sphinx 的创建者 Pat Allan,我只是在这里复制它,希望它能帮助遇到这个问题的其他人:

给定环境的设置(例如来自 config/thinking_sphinx.yml)现在在配置 Thinking Sphinx 框架时重新加载(以适当地重新应用任何给定值)。但是,Flying Sphinx 将自定义连接参数设置到 Ruby 方面的此设置哈希中,因此这些细节会丢失并且不会重新应用(因为它们不在文件中)。

The fix - at least for the moment - is as follows:

* In your Gemfile, set flying-sphinx's require to nil (so it's not loaded initially). 
* In your config/boot.rb file, add `require 'flying_sphinx/sinatra'` just after you switch Thinking Sphinx frameworks
于 2013-09-28T07:25:59.983 回答