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

Funny thing, Sphinx reserved class names

Open Shinta opened this issue 14 years ago • 2 comments

So, I have a site, and I have Ads, and every Ad has a Source, which is a belongs_to relation, so Ad belongs to Source, and of course there is a sources table. I was just trying to make a custom join to have "has" index with TS and when a ran the config rake it printed the following error "undefined method `__path' for #ThinkingSphinx::Source:0x007ff26e24c238", and that's it, there is a Class within TS that's called Source and It conflicts with mine. I fixed with a monkey patch in my relations with I just wanted you to know.

TS is awesome.

Hugs.

Shinta avatar Jul 25 '12 15:07 Shinta

Ah, good to know you got a work-around figured out! There's also the assoc method, which allows you to work around any reserved methods:

has assoc(:source).id, :as => :source_id

Thanks :)

Pat

On 25/07/2012, at 5:10 PM, Augusto Ruibal wrote:

So, I have a site, and I have Ads, and every Ad has a Source, which is a belongs_to relation, so Ad belongs to Source, and of course there is a sources table. I was just trying to make a custom join to have "has" index with TS and when a ran the config rake it printed the following error "undefined method `__path' for #ThinkingSphinx::Source:0x007ff26e24c238", and that's it, there is a Class within TS that's called Source and It conflicts with mine. I fixed with a monkey patch in my relations with I just wanted you to know.

TS is awesome.

Hugs.


Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/375

pat avatar Jul 26 '12 20:07 pat

Hey Pat,

Awesome, that's much cleaner that my monkey patch.

Thank you.

Shinta avatar Jul 26 '12 20:07 Shinta