Take the 2-minute tour ×

(see title) here is the code, I'm using ms command prompt (irb) to do this, which may in itself be wrong.


\<\lass CreateProducts < ActiveRecord::Migration

irb(main):002:1> def up

irb(main):003:2> create_table :products do |t|

irb(main):004:3* t.string :name

irb(main):005:3> t.text :description

irb(main):006:3> t.timestamps

irb(main):007:3> end

irb(main):008:2> end

irb(main):009:1> end

NameError: uninitialized constant ActiveRecord

   from (irb):1

   from C:/Ruby193/bin/irb:12:in `<main>'


I know that it's not supposed to be \<\lass but that's not what I typed and I think that's not the issue but I'm not sure.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You need to require 'active_record'. I agree that you may run into other issues trying to migrate by hand.

share|improve this answer
What is the better way to do it? I'm a noob to rails. I'll look into it but I'd appreciate some Google-searchable keywords –  boulder_ruby May 8 '12 at 4:27
Just do the migration, then reverse it with db:rollback. Take a look at the Rails Migration guide for more info. –  x1a4 May 8 '12 at 5:43
Everything works now that I've ironed out my problems with mysql. Everything works when mysql works in my experience. –  boulder_ruby May 17 '12 at 4:35

Your Answer


