pat / thinking-sphinx

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

Support Octopus gem's Octopus::ProxyConfig #1090

Closed lunaru closed 6 years ago

lunaru commented 6 years ago

@pat

On Octopus 0.9.x the model.connection method doesn't return a normal ActiveRecord::ConnectionAdapters::PostgreSQLAdapter (or whatever is configured). Instead a Octopus::ProxyConfig is returned which proxies a lot of the functionality.

In this case, @config instance variable is not guaranteed to exist. We need to check for this.

Let me know if you have a better idea for addressing this problem.

pat commented 6 years ago

Thanks for this :) I just pushed a slight refactor (6183339d56b1ddd0cb949ed81b0638054635fc38) but behaviour should remain the same as what you need. Do feel free to try it out, though!

Oh, and it's worth noting: the develop branch is pretty much the 4.0 release - I'm just waiting for Rails 5.2.0 proper to be released, so I can confirm everything's fine with that and then publish the update. Here is a draft of the release notes, so you're across what's changed since TS v3.4.2: https://gist.github.com/pat/cf5a59f3b5d8c803cc45fa6021b8fddb

lunaru commented 6 years ago

We're now using the refactored version and it's working great. Thanks!