Production Migrations Failing

I obviously have no idea what I'm doing. My app is running fine
locally. I just finished setting up my vps with mod_rails, and it can
run a simple app.

Then, I use git to checkout my app, and try to run the migrations.
They work alright, except that in a couple of the migrations, I had
added some sample records. So, in the first migration, I add a
"games" table, with a title and description, then I call
Game.create :title => 'asdf', :description => 'asdf' a couple of times
for the different games. These games never show up in the database. I
thought create was supposed to save the records to the db as well?

I think the problem is that I don't have any idea how to deploy a
rails app "the right way." What am I missing?

Thanks

I obviously have no idea what I'm doing. My app is running fine
locally. I just finished setting up my vps with mod_rails, and it can
run a simple app.

Then, I use git to checkout my app, and try to run the migrations.
They work alright, except that in a couple of the migrations, I had
added some sample records. So, in the first migration, I add a
"games" table, with a title and description, then I call
Game.create :title => 'asdf', :description => 'asdf' a couple of times
for the different games. These games never show up in the database. I
thought create was supposed to save the records to the db as well?

My guess would be failing validations.

Fred

You’re right! Thanks! I had my Game model validating that it belonged to at least one category, and there is no way to do that in that migration (since the categories hadn’t been created yet).

You're right! Thanks! I had my Game model validating that it
belonged to at least one category, and there is no way to do that in
that migration (since the categories hadn't been created yet).

That's one good reason for not using models in migrations, you can get
a mismatch between what the model was at the time the migration was
written and what it is when the migration is run.
If you're only using the model to avoid writing raw sql, one work
around is to put something like

class SomeMigration < ActiveRecord::Migration
   class Game < ActiveRecord::Base; end

   def up
     ..
   end
   ...
end

in your migration. You might need to call
Game.reset_column_information after you've done the create_table.

Fred