gr

Hi,

I'm getting my records using:

@users= User.find(:all,:conditions=>["country=? ",country])

where country is a String with the name of the country.

But now I want to get the result for different countries. I have an array countries = ['Germany','France','Spain']

and I want to get all the records where country is one of those included in the array

How can I do that?

Thanks

You just need to use "IN" instead of "="

countries = ['Germany','France','Spain'] ... @users= User.find(:all,:conditions=>["country IN(?)", countries])

This will result in a statement like:

select * from users where country in('Germany','France','Spain')

M