2
votes

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.

1
Can you show us your config/environment.rb please? I think you may have removed the activerecord framework.Ryan Bigg
What's the output of "gem list --local"?Arne
Here is the enviroment.rb pastie.org/650760 and "gem list --local" pastie.org/650759ThoKra
Can you try updating rails to the newest version and change your app to that version (In the environment.rb) and tell us if that changes anything?Arne
It all works with a different table, It's just something with this one which doesn't want to cooperate.ThoKra

1 Answers

5
votes

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.