我收到一个错误:
SQLite3::SQLException: no such column: ideas.list_id:
SELECT "ideas".* FROM "ideas"
WHERE "ideas"."list_id" = 2
但我加了
t.integer :list_id
到我的数据库迁移文件:
class CreateIdeas < ActiveRecord::Migration
def change
create_table :ideas do |t|
t.string :name
t.text :description
t.string :picture
t.timestamps
end
add_foreign_key :ideas, :lists
end
end
这给了我这个:
class CreateIdeas < ActiveRecord::Migration
def change
create_table :ideas do |t|
t.string :name
t.text :description
t.string :picture
t.integer :list_id
t.timestamps
end
add_foreign_key :ideas, :lists
end
end
然后我输入
rake db:migrate
知道为什么我会收到一个错误说没有专栏吗?我还是 RoR 的新手。我必须以其他方式添加一列吗?
谢谢