Hi,
I am sending data via get and I need to put it into a int array to be used in a find. here is my code :
@found = Array.new
params['candidate'].each do |c|
@found << c.to_i
end
My url looks like this
http://localhost:3000/export/candidate?candidate[]=3&candidate[]=4&commit=Export
If it makes any difference I am using it for this find
@candidate = Candidate.find(:all, :conditions => ["candidates.id IN ?", @found])
But currently it doesn't put it in a real array because I get this error
Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4)' at line 1: SELECT * FROM `candidates` WHERE (candidates.id IN 4,2)
The brackets are missing around the array
Thanks and good morning!
Alex