MySQL Where conditions automatic formatting


I’m having a problem with the automatic formatting of my mysql query.

My code is this:

Tablename.find(:all, :conditions => {:id => list})

Where list is a list of id’s (8,9,10)

The problem is that the query is automatically formatted to this:

SELECT * FROM Tablename WHERE (id in (‘8,7,9’))

I need this query to run without the extra single quotes to work properly.

ie: SELECT * FROM identifications WHERE (id in (8,7,9))

How do I go about this?



list needs to be an Array, not a String:

  list = [8,7,9] # array of values

It looks like you have list as a string "8,7,9", which is a single value.