I am using mysql2 in my ruby script. using this to test API responses against the mysql DB
this is a snippet of my script
test_job_by_id_5
id = $data["jobs"]["id"][i] # example 5
job = JobServices.job_by_id(id)
response = @@con.query("select * from jobs where id = #{id}") #select * from jobs where id =5
rs=response.collect #this fails
assert_match(job[0]['title'],rs[0]['title'],"The title values are equal for #{$data["jobs"]["id"][i]}")
end
So when i use this with ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10]
it works like a charm
but when i use ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
it does not work
i get this error
NoMethodError: undefined method '[]' for
#<Enumerator: #<Mysql2::Result:0x00000012d19f18>:collect>
Can some one please help me fix this?