thinking-sphinx icon indicating copy to clipboard operation
thinking-sphinx copied to clipboard

Allow disabling auto extending ActiveRecord::Base

Open ur5us opened this issue 2 years ago • 2 comments

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 avatar Jan 25 '23 03:01 ur5us

@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.

ur5us avatar Jan 25 '23 03:01 ur5us

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 avatar Jan 25 '23 08:01 pat

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

pat avatar Jul 07 '24 11:07 pat