【发布时间】:2013-07-04 22:09:07
【问题描述】:
class CreateBallots < ActiveRecord::Migration
def change
create_table :ballots do |t|
t.references :user
t.references :score
t.references :election
t.string :key
t.timestamps
end
add_index :ballots, :user
add_index :ballots, :score
add_index :ballots, :election
end
end
结果:
SQLite3::SQLException: table ballots has no column named user: CREATE INDEX "index_ballots_on_user" ON "ballots" ("user")/home/muhd/awesomevote/db/migrate/20130624024349_create_ballots.rb:10:in `change'
我以为 t.references 应该为我处理这个问题?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3.2 rails-migrations