Find_with_ferret conditions?

Hello all,
I’m trying to use acts_as_ferret to not only search for records, but to
combine it with a filter function that filters those results by other
things
as well.

http://pastie.textmate.org/244035

That gives an example of the Game.filter function. It is supposed to
take a
hash of parameters, and give you the filtered results. The parameters
this
is supposed to support are: players - the number of players, category -
a
habtm relationship, and q - a search query (on title or description).

First, if my approach to a filter function is totally wrong let me know.
This seems like it should work, but {:players => 2} gives me “wrong
number
of bind variables (2 for 1) in: games.id in (?) and min_players <=
:players
and max_players >= :players”. I get the same type of error if I send it
a
category as well, or if I combine either with a search query.

The logger is outputting the hash for final_conditions as I expect.
Also,
this works fine if I leave out the searching, so if I changed the last
line
to

results = Game.find(:all, :conditions => finalconditions, :include =>
includes)

It works, but leaves out the search query in the filter.

Thanks for your help!
~sean

Any ideas on this? Am I taking the wrong approach?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs