我的 twilio 应用程序的控制器中有以下代码,您将在“id = user ...”行中看到错误:
class CallsController < ApplicationController
def play
user = Refugee.find_all_by_cell_number(params[:id]) && Student.find_all_by_cell_number(params[:id])
id = user[:last_class].to_i
lesson = RecordedLesson.find(id).next
user[:last_class] = lesson.id
user.save
@audio_lesson_url = lesson.sound_file.url
render :action => "play.xml.builder", :layout => false
end
end
然后我收到以下错误消息
app/controllers/calls_controller.rb:7:in `play'=2012-09-18T04:00:13+00:00 app[web.1]: TypeError (can't convert Symbol into Integer):
尽管我运行了以下迁移
class ChangeLastClassOfStudents < ActiveRecord::Migration
def change
change_column :students, :last_class, :integer, :null => true
end
end