重命名模型后,Rails将无法识别键

时间:2012-10-04 17:44:58

标签: ruby-on-rails ruby database ruby-on-rails-3

我刚使用此命令将我的表格客户端重命名为人员

class RenameClientsToPeople < ActiveRecord::Migration
  def change
    rename_table :clients, :people
  end
end

然后我仔细地将所有实例,文件名和外键(感谢Veraticus)从客户端重命名为 person ,从客户端重命名为的。但由于某种原因,我仍然会遇到这样的错误:

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识别新的主键?

0 个答案:

没有答案