Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. can't convert Question into Integer error In a rails 3 app
  2. current_user.id is an integer
  3. Questions table - id is an integer
  4. Answers table - question_id and user_id are integers
  5.        
  6. @questions.each do |q|
  7.   ans[q] = Answer.where("question_id = ? AND user_id = ?", q.id, current_user.id ) # this is line 27
  8. end
  9.        
  10. ans[q.id] = Answer.where("question_id = ? AND user_id = ?", q.id, current_user.id )