On Wed, Mar 21, 2007 at 10:56:42PM +0100, Henrik Z. wrote:
end
And I get the following error
Cannot delete for id of type Array
As I see it the only way this could happened is if search_each
returns an Array of ID’s but it couldn’t right?
from the api docs:
search_each(query, options = {}) {|doc, score| …}
you see that ferret hands you two arguments into the block.
Now if you only accept one parameter, Ruby guesses that you want
all parameters as an array. This should yield a warning like
‘multiple values for a block parameter (2 for 1)’
somewhere in your logs.
So just use |id, score| and everything should be fine
cheers,
Jens
–
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66 [email protected] | www.webit.de
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
you see that ferret hands you two arguments into the block.
Now if you only accept one parameter, Ruby guesses that you want
all parameters as an array. This should yield a warning like
‘multiple values for a block parameter (2 for 1)’
somewhere in your logs.
So just use |id, score| and everything should be fine
So its that ruby magic trying to figure out what I want again. =)
I was afraid that only using id and not score could be the problem
but I couldn’t see why. Now I know!