pat / thinking-sphinx

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

Allow disabling auto extending ActiveRecord::Base #1241

Closed ur5us closed 1 month ago

ur5us commented 1 year ago

Method names like .search can collide with existing scopes which then results in the following error:

You tried to define a scope named "search" on the model "…", but Active
Record already defined a class method with the same name.

With that setting being set to false it allows one to enable ThinkingSphinx per model instead of globally.

ur5us commented 1 year ago

@pat It’s been a long time that we’ve chatted about this in the RubyNZ Slack. Anyway, I’m curious whether you’d be open to this type of feature? For the moment there are no tests as I’m testing the waters. Moreover, not entirely sure how to approach testing other than creating another test app and then testing for the absence of methods on ActiveRecord::Base.

pat commented 1 year ago

Hi @ur5us :) Very happy to have this feature, though yes, it's a hard thing to test. If you could try it out with a test app that'd be a great place to start - not sure we can do much more than that.

pat commented 1 month ago

Ended up implementing this in #1265, and is part of 5.6.0 which has just been released :)