我刚刚使用以下命令将我的表Client重命名为Person :
class RenameClientsToPeople < ActiveRecord::Migration
def change
rename_table :clients, :people
end
end
然后我小心地从client到person以及从clients到people重命名所有实例、文件名和外键(感谢 Veraticus)。但由于某种原因,我仍然会收到这样的错误:
SQLite3::SQLException: no such column: people.person_id: SELECT COUNT(*) FROM "projects" INNER JOIN "people" ON "projects"."person_id" = "people"."person_id" WHERE "people"."user_id" = 1
为什么 Rails 不能识别新的主键?