【发布时间】:2009-10-11 20:49:40
【问题描述】:
在 SqlLite3 中创建新表时遇到问题
我使用脚手架生成器创建了这个迁移:
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
尝试迁移时出现此错误:
>耙分贝:迁移 (在 C:/...) 耙中止! 未初始化的常量 ActiveRecord C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2359:in `raw_load_rakefile' (通过使用 --trace 运行任务查看完整跟踪)我昨天开始从 PHP 适应 RoR,如果这是一个明显的答案,很抱歉,但我已经尝试了我所知道的一切,但没有任何解决方法。
【问题讨论】:
-
你能给我们看看你的 config/environment.rb 吗?我想你可能已经删除了 activerecord 框架。
-
“gem list --local”的输出是什么?
-
这里是 enviroment.rb pastie.org/650760 和 "gem list --local" pastie.org/650759
-
您能否尝试将 rails 更新到最新版本并将您的应用程序更改为该版本(在 environment.rb 中)并告诉我们是否有任何变化?
-
这都适用于不同的表,只是这个不想合作的东西。
标签: ruby-on-rails activerecord