create statement in migration file does not work

I have:

class CreateGuests < ActiveRecord::Migration    def self.up      create_table :guests do |t|        t.string :namen        t.text :comment        t.integer :admin, :default => 0        t.integer :deleted, :default => 1        t.timestamps      end

     Guest.create(:namen => "aaa, :comment => "bbb", :admin => 1, :deleted => 0)


   def self.down      drop_table :guests    end end

Migration runs fine - "rake db:migrate --trace" gives no errors but the guest is not created!

Any hints?

PS: I run Rails 2.0.2


Ups...I just replaced the real name with "aaa" and forgot the closing quote.

Have you any validation rules that would prevent it being saved?

Jochen Kaechelin wrote:

I HAD some:

     before_validation :trim_strings      before_save { |guest| guest.password = md5_pass(guest.password) if guest.not_enabled? }

but I disabled them.

rake db:migrate --trace

(in /Users/bullet/Documents/RAILS_WORK/...........) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == 1 CreateSessions: migrating

I didn't know you could put dummy data directly into the migration -- thanks!


This would not work here, because I need to store more then true or false in this two fields - I think I should find better labels for these fields....perhaps rights and status....