views:

650

answers:

1

Hello, have a problem creating my new table in 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

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.

+3  A: 

You can't call your table times since that would need a model class called Time which is a built-in Ruby class. I bet that is the problem. Try changing it to something else and see if that helps.

Daniel Kristensen
Ofc, it worked :)
Terw
I should have thought less about the versions and more about the code ;-)
Caffeine
Yeah that was a tricky one :)
Daniel Kristensen