This doesn’t seem to be working :
@zip = %w[07005, 07034, 07035]
CardSignup.find(:all, :conditions => ["zip_code IN (?)", @zip])
=> [ ]
However, if I do a simple find_by with the second zip code, it returns a result :
CardSignup.find_by_zip_code("07034")
=> Object<x01231 ..
What am I doing wrong ?
Your implementation of the array is incorrect. The way you have it at the moment the commas are part of each array object:
You should implement this with the commas removed:
or:
So the full implementation is: