using like a simple array worked like a charm, thanks a lot :-D I can't believe it was so simple :-): cont = 0 queryArray.each{ |q| cadarray.concat( ["%#{queryArray[cont]}%"] ) cont +=1 } Thanks again. Brian Candler wrote: > Alex Moreno wrote: >> >> Thanks a lot for your answer. >> >> The problem is that map doesn´t add commas, i get: >> >> title OR description LIKE ? AND title OR description LIKE ? >> %pullmantur%%test% >> >> and i need >> >> title OR description LIKE ? AND title OR description LIKE ? >> %pullmantur%,%test% >> >> >> so i get this answer for more than 1 parameter: >> >> wrong number of bind variables (1 for 2) in: title OR description LIKE >> ? AND title OR description LIKE ? > > If this is ActiveRecord then you don't want commas, you want an array > like this: > > ["title OR description LIKE ? AND title OR description LIKE ?", > "%pullmantur%", "%test%"] > > because each ? pulls the next value out of the array. > > So if you're getting only one bind variable instead of 2, it's because > your queryArray has 1 element instead of 2. > > But if you're using a different DB access framework then YMMV. -- Posted via http://www.ruby-forum.com/.