Question: ok, so probably best if i just paste code and then explain

```
   search = "your horses"

   exp1 = ""
   exp2 = ""

   myarray = search.split(/ /)
   mylength = myarray.length           #this would return 2 in this case

   mylength.times do
    exp1 += "AND name LIKE ? "         #this gives--> AND name LIKE ? AND name LIKE ?
   end

   for i in 0..(mylength - 1)
    exp2 += ("%#{myarray[i]}%, ")    #and this gives--> your, horses,
   end

find(:all, :conditions => ["#{exp1}",  exp2])

```

and here at the end i get a problem because exp2 becomes 'your, horses,' inside the find function. what do i have to do that inside these conditions there would be no additional single quote marks inserted?

or maybe i should do it some other way?

thank you very much for your answers!

Answer: 
```
   search = "your horses"
   myarray = search.split(/ /)
   mylength = myarray.length    
   find(:all, :conditions => [myarray.map{|x| 'name like ?'}.join(' AND '),  *(myarray.map{|x| "%#{x}%"})])

```
I have no idea how to write this in Ruby, however as a general rule when compiling comma separated values, I've found it easiest to put the comma at the beginning when you are appending like so:

```
var = '';

var += ',name1';
var += ',name2';
var += ',name3';

print substring(var, 1);

```

This has always been easier for me, rather than trying to detect the extra comma and chop it off of the end. Hopefully there's a substring command in Ruby. :)