quick update...

Upon reading some more of the documentation I managed to get

Contract.search_for_ids('something_unusual')

returning the ids I was looking for (search returns a
WillPaginate::Collection). And mucking around with my code a bit
further it turns out the problem was that the legacy database table
that my rails app wraps around had an 'ID' and not an 'id' column.

I added

set_primary_key 'ID'

to the model and bingo bango, the search started working again. The
most frustrating part of all this is that I had my code working a
while back before I made some sweeping changes and this is probably
the second time I have solved this problem. So I'm posting this as a
reminder to myself in 6 months time when it happens again ;)

On Jan 19, 11:40 pm, Derek Mailer <[email protected]> wrote:
> Hi all,
>
> Can anyone explain why I can do this at the command line...
>
> *search 'something_unusual'*
>
> ...and get 2 results, but when I do this in the console of my rails app I
> get nils back instead of the model id number?...
>
> *>> Contract.search('something_unusual')
> => [nil, nil]*
>
> I'm running Sphinx 0.9.8-release (r1371), RAILS 2.1.0 and will_paginate gem
> version 2.2.2
>
> Thanks,
> Derek
--~--~---------~--~----~------------~-------~--~----~
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