Gene Jones
10/6/2007 11:19:00 PM
Its ok, just realised I hadn't created the model first.
Thanks anyway.
Gene
On Oct 6, 6:11 pm, Gene Jones <drgenejo...@gmail.com> wrote:
> Hi,
>
> I am trying to create a user_types table and insert two rows into it.
> See code below:
>
> class CreateUserAccountTypes < ActiveRecord::Migration
> def self.up
> create_table :user_types do |g|
> g.column :name, :string, :default => nil
> g.column :has_admin_access, :boolean, :default => false
> end
>
> UserType.create :name=> 'Member', :has_admin_access => false
> UserType.create :name=> 'Admin Member', :has_admin_access => true
> end
>
> def self.down
> drop_table :user_types
> end
> end
>
> However I keep getting this error after running rake db:migrate
> (in C:/Ruby/InstantRails/rails_apps/Eivom)
> == CreateUserAccountTypes: migrating
> ======================================
> -- create_table(:user_types)
> -> 0.0220s
> rake aborted!
> uninitialized constant CreateUserAccountTypes::UserType
>
> (See full trace by running task with --trace)
>
> It works fine if I remove the "UserType.create " line. Any ideas?
>
> Thanks
> Gene