title: SQL query IN using Ruby array
body: <p>I have an array in ruby 2.0.0, <code>@temp = [3, 4]</code> which I want to use in SQL <code>IN</code> statement. So I want the brackets (<code>[, ]</code>) to be removed. </p>
  
  <p>My SQL query:</p>
  
  <pre><code>SELECT E.id,E.name, CEU.attempt, E.total_mark, CEU.has_attended as attendance, CE.id as categoryexamId, CE.examtype_id as examType, CU.id as categoryuserId, U.name as username
  
        FROM exams E
        Inner Join categoryexams CE on E.id = CE.exam_id
        Inner Join categoryexamusers CEU on CE.id = CEU.categoryexam_id
        Inner Join categoryusers CU on CEU.categoryuser_id = CU.id
        Inner Join categories C on CE.category_id = C.id
        Inner Join users U on CU.user_id = U.id
        Inner Join examtypes ET on CE.examtype_id = ET.id
        WHERE CE.category_id = #{category_id} AND CEU.has_attended = 1 AND U.id = #{user} AND CE.currentyear = #{academicYear} AND CE.examtype_id = #{examtype}" + (@temp.blank? ? "" : " AND CEU.categoryexam_id NOT IN (#{@temp})") +
        " Group By CE.id;
  </code></pre>