我目前正在做一个 Rails 项目。当我尝试启动 rails 服务器时,它会抛出以下错误:
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters
/sqlite_adapter.rb:439:in `table_structure': Could not find table 'dbrick'
(ActiveRecord::StatementInvalid)
我的表名是“砖”。我还尝试 rake db:drop 和 rake db:mirgrate。迁移时抛出以下错误:
rake aborted!
Could not find table 'dbrick'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
这是我的迁移文件:
class CreateDbricks < ActiveRecord::Migration
def self.up
create_table :dbricks do |t|
t.text :description
t.string :video
t.string :video_html
t.string :image_id
t.string :option_id
t.boolean :choice
t.string :reach
t.integer :category_id
t.string :user_id
t.datetime :deleted_at
t.timestamps
end
end
def self.down
drop_table :dbricks
end
end
如果有人帮助我解决这个问题,那将是非常有帮助的。提前致谢。