In a Rails 3 application that utilizes a MySQL database there are the following integers:
current_user.id is an integer
Questions table - id is an integer
Answers table - question_id and user_id are integers
In my controller:
@questions.each do |q|
ans[q] = Answer.where("question_id = ? AND user_id = ?", q.id, current_user.id ) # this is line 27
end
Why do I get the following error:
can’t convert Question into Integer
app/controllers/applets_controller.rb:27:in
[]='show’
app/controllers/applets_controller.rb:27:in
app/controllers/applets_controller.rb:25:in `show’
Thanks!
Maybe this will help you: