我重命名了一个表的 3 列,突然我的所有单元和功能测试都抛出了相同的错误,即他们找不到具有旧列名的表。即使是与我修改的表无关的模型测试也会抛出同样的错误:
例子:
54) Error:
test_should_show_user(UsersControllerTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: table answers has no column named id_user: INSERT INTO "a
nswers" ("id_user", "id_survey", "id_question", "answer", "created_at", "updated_at", "id") VALUES ('MyString',
1, 1, 'MyText', '2012-06-16 17:45:56', '2012-06-16 17:45:56', 980190962)
这是我在迁移中所做的更改表的操作:
class EditAnswersTable < ActiveRecord::Migration
def self.up
rename_column :answers, :id_user, :user_id
rename_column :answers, :id_survey, :survey_id
rename_column :answers, :id_question, :question_id
end
def self.down
rename_column :answers, :user_id, :id_user
rename_column :answers, :survey_id, :id_survey
rename_column :answers, :question_id, :id_question
end
end
我重新启动了控制台和 Eclipse,但没有任何改变。
应用程序本身在服务器上运行良好,那么为什么每次测试都会抛出这些错误呢?
我该怎么办?提前致谢。