Hi Henrik If you're not using STI, then your manual change should be fine - but essentially, for STI searches, Thinking Sphinx needs to know about all subclasses - and ActiveRecord doesn't load all the models in automatically, so on first load ParentModel.send(:subclasses) is empty. Hence the forced load.
I realise this may cause problems for some people, but I don't know of a better approach yet. -- Pat On 22/10/2008, at 11:13 PM, Henrik Nyh wrote: > > Looked into this further. > > So Blake's fork works for me. "Edge" Thinking Sphinx > (freelancing-god/thinking-sphinx.git) does not. > > Blake's stuff *was* put into TS, though rewritten: > > commit ebf590edafeccd302c56c3b686ddc8e15b36f20d > Author: Pat Allan <[EMAIL PROTECTED]> > Date: Sun Oct 12 11:19:41 2008 +0700 > ActiveRecord 1.2.6 and 2.0.x support fixed - thanks to Blake > Watters for pointer > > That version of TS works fine for me, and later versions up until > and including > > commit c7f6cf7366dfb9faf707d615d8a7c2e1cdbe6a62 > Author: Pat Allan <[EMAIL PROTECTED]> > Date: Sun Oct 12 18:26:14 2008 +0700 > Adding proper CRC32 support for PostgreSQL - which means working > STI searches for Postgres > > But this commit ironically breaks things again: > > commit 309cb086382af0321acc92b489afbfa75aaa3590 > Author: Pat Allan <[EMAIL PROTECTED]> > Date: Sun Oct 12 20:58:42 2008 +0700 > Adding manual load_models call for Rails pre 2.1 - the other > prepare catch only happens on reloads, not initial load (unl... > > That commit > (http://github.com/freelancing-god/thinking-sphinx/commit/309cb086382af0321acc92b489afbfa75aaa3590 > > ) > adds this to init.rb: > > if Rails::VERSION::STRING.to_f < 2.1 > ThinkingSphinx::Configuration.new.load_models > end > > If I undo that change (just changing the "2.1" to "2.0"), things work > fine with edge TS. I'm not sure what should be done, though. Since the > change unbreaks 2.0.2 for me, presumably "< 2.1" is incorrect, but I > don't what version would be correct here. > > Pat, could you give more details on what 309cb was meant to fix? Might > the version number check be off, or is it more likely there is > something unexpected in my configuration? > > On Wed, Oct 22, 2008 at 4:13 PM, Henrik Nyh <[EMAIL PROTECTED]> wrote: >> Blake, >> >> Your fork fixed it. Thanks so much! >> >> On Wed, Oct 22, 2008 at 3:50 PM, Blake Watters <[EMAIL PROTECTED] >> time.com> wrote: >>> There were some Rails 2.0.2 incompatibilities I ran into in >>> Thinking Sphinx. >>> They exhibited the same symptoms you are describing. I fixed these >>> on my >>> GitHub fork: http://github.com/blakewatters/thinking-sphinx/tree/master >>> >>> I submitted a pull request, but I do not know if the changes ever >>> made it >>> into Pat's master codebase. You may want to try my fork. >>> >>> Cheers, >>> Blake >>> >>> On Wed, Oct 22, 2008 at 7:38 AM, Henrik Nyh <[EMAIL PROTECTED]> wrote: >>>> >>>> Trying to add Thinking Sphinx to a Rails 2.0.2 app that is >>>> currently >>>> using Ultrasphinx. >>>> >>>> After adding thinking-sphinx to my vendor/plugins, I was getting >>>> >>>> Expected /Users/henrik/Sites/example/app/models/user/ >>>> foo_extension.rb to define User::FooExtension >>>> >>>> when I tried "rake ts:in", but also e.g. when trying to migrate or >>>> open script/console. Anything that tries to load the Rails env >>>> fails. >>>> >>>> After some experimentation, it turns out it starts working if I >>>> disable my observers (comment out config.active_record.observers = >>>> [...] in config/environment.rb). >>>> >>>> Searching this list, I noticed Sean Cribbs mentioning similar load >>>> order errors here: >>>> http://groups.google.com/group/thinking-sphinx/browse_thread/thread/e5898c6300927e77/860c0bfd781e6fe8 >>>> >>>> I also searched for "observers" but didn't see previous mention of >>>> that, specifically. >>>> >>>> A possible workaround would be to use callbacks instead of >>>> observers, >>>> of course, but I'd like to avoid that. I'll keep looking into this. >>>> Has anyone ran into something similar and have any suggestions? Is >>>> anyone successfully using observers in an app that also uses >>>> Thinking >>>> Sphinx? Anyone with Rails 2.0.2 using observers + TS? >>>> >>>> >>> >>> >>>>> >>> >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to thinking-sphinx@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en -~----------~----~----~----~------~----~------~--~---