I'm trying to create a migration for a simple table that is just used as an enum. So I want to populate the table immediately with its values. I tried the following:
class CreateUserTypes < ActiveRecord::Migration
def self.up
create_table :user_types do |t|
t.column :type, :string
t.timestamps
end
end
def self.down
drop_table :user_types
end
UserType.create :type => "System administrator"
UserType.create :type => "Simulation controller"
end
but I get this error:
rake aborted!
An error has occurred, all later migrations canceled:
Could not find table 'user_types'
I was following the Rails wiki and expected it to work.