Thanks for the help with this Nicolas - just pushed a commit that  
fixes it.

Cheers

-- 
Pat

On 21/10/2008, at 6:12 PM, slainer68 wrote:

>
> Hi Pat.
>
> The problem resides in :
> http://github.com/freelancing-god/thinking-sphinx/tree/master/lib/thinking_sphinx/active_record.rb#L148
>
> in the method :
>
>    def sphinx_document_id
>      (self.id * ThinkingSphinx.indexed_models.size) +
>        ThinkingSphinx.indexed_models.index(self.class.name)
>    end
>
> When you delete a STI object, toggle_deleted and other methods use
> this method. Because ThinkingSphinx.indexed_models does not contain
> the STI models but only the models that have an index, this method
> fails.
>
> Nicolas.
>
> On 18 oct, 16:33, Pat Allan <[EMAIL PROTECTED]> wrote:
>> Hi Nicolas
>>
>> Not sure where you've made this code change? Also, with the STI
>> reworking from a month or two ago, I thought this situation was
>> covered by self.class_from_crc in ThinkingSphinx::Collection. Could  
>> be
>> wrong though...
>>
>> Cheers
>>
>> --
>> Pat
>>
>> On 10/10/2008, at 5:15 PM, slainer68 wrote:
>>
>>
>>
>>> Hi!
>>
>>> I think I've found a STI bug in TS. The problem resides in the  
>>> method
>>> sphinx_document_id that is mainly use by delta methods.
>>> When calculating the sphinx_document_id, TS uses
>>> ThinkingSphinx.indexed_models that only contains the models that  
>>> have
>>> an index (and does not contains the childs). When trying to  
>>> calculate
>>> the index from the name of a STI model it fails with "TypeError: nil
>>> can't be coerced into Fixnum" because the child model name is not in
>>> the array...
>>
>>> For now I've changed the method to find the index from
>>> self.class.base_class.name instead of self.class.name.
>>> Don't know if that is the best solution and if it does not create
>>> duplicate ids, but it seems to work for me.
>>
>>> Nicolas.
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to