[英]“uninitialized constant ActiveRecord” on migration
have a problem creating my new table in SqlLite3 在SqlLite3中创建新表时遇到问题
I have created this migration using the scaffolding generator: 我使用脚手架生成器创建了此迁移:
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
the name of the file is 20091011203652_create_times.rb
该文件的名称是20091011203652_create_times.rb
When trying to migrate I get this error: 尝试迁移时出现此错误:
>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)
I started adapting from PHP to RoR yesterday, so sorry if it's an obvious answer, but have tried everything I know, but nothing solves it. 我昨天开始从PHP适应RoR,因此很抱歉,如果这是一个显而易见的答案,但尝试了我所知道的一切,但没有任何解决方案。
You can't call your table times since that would need a model class called Time
which is a built-in Ruby class. 您无法调用表时间,因为这将需要一个名为Time
的模型类,该模型类是内置的Ruby类。 I bet that is the problem. 我敢打赌这就是问题所在。 Try changing it to something else and see if that helps. 尝试将其更改为其他内容,看看是否有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.