2009-10-11 21 views
1

在SqlLite3“未初始化不断ActiveRecord的”关于迁移

我一直在使用脚手架生成创建了这个迁移创建我的新表有关的问题:

class CreateTimes < ActiveRecord::Migration 
    def self.up 
    create_table :times do |t| 
     t.integer :regsite 
     t.integer :user_id 
     t.timestamp :added 
     t.integer :time 
     t.text :note 

     t.timestamps 
    end 
    end 

    def self.down 
    drop_table :times 
    end 
end 

文件的名称是20091011203652_create_times.rb

试图迁移时出现此错误:

 
>rake db:migrate 
(in C:/...) 
rake aborted! 
uninitialized constant ActiveRecord 
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2359:in `raw_load_rakefile' 
(See full trace by running task with --trace) 

昨天我开始从PHP适应RoR,所以很抱歉,如果这是一个明显的答案,但已经尝试了我所知道的一切,但没有任何解决办法。

+0

你能告诉我们你的config/environment.rb吗?我想你可能已经删除了activerecord框架。 –

+0

“宝石列表 - 本地”的输出是什么? – Caffeine

+0

这里是enviroment.rb http://pastie.org/650760和“gem list --local”http://pastie.org/650759 – ThoKra

回答

4

你不能打电话给你的表因为那需要一个叫做Time的模型类,它是一个内置的Ruby类。我敢打赌,这是问题所在。尝试改变它到别的东西,看看是否有帮助。

+0

Ofc,它的工作:) – ThoKra

+0

我应该少想一下版本和更多关于代码;-) – Caffeine

+0

是的,这是一个棘手的:) –

相关问题