It's likely an array of active record objects.
Try
@people = Person.search :conditions => {:town_id => @local_towns.map { |lt|
lt.id }}
or similar...
On Fri, Apr 10, 2009 at 7:19 PM, James Healy <[email protected]> wrote:
>
> Are you sure you're @local_towns array has only ints in it? It seems
> *very* odd that a manual array of ints works but an array stored in a
> variable doesn't.
>
> -- James Healy <jimmy-at-deefa-dot-com> Sat, 11 Apr 2009 09:17:03 +1000
>
> sandy wrote:
> > I have an array of local towns (@local_towns) relative to the current
> > town and want to find all people living in a local town...
> >
> > The current controller logic I'm converting over to thinking sphinx is
> > as follows:
> > @people = Person.find(:all, :conditions => ["town_id IN(?)",
> > @local_towns])
> >
> > However, when I try to use thinking sphinx, it throws an undefined
> > method `to_f' error
> > @people = Person.search :conditions => {:town_id => @local_towns}
> >
> > although entering the array manually seems to work ok...
> > @people = Person.search :conditions => {:town_id => [1, 2, 3]}
> >
> > Is there something I'm missing?
> >
> > >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---