Model validation crashes my early migrations - what to do?

Migrations are for database management, not creation of test data. The test framework works quite well to allow you to do setup tasks that create test data and then run the test. If you are wanting to create test data for manual testing then use a separate controller action pair like test/create_test_data and point to that in your browser. Migrations are at the database level and not the model level. The test framework operates above the model and controller level so it is a better place to put such logic. I would recommend Agile Web Development with Rails as a first book as it is pretty clear on the layering and where different types of logic best reside.

If you are wanting to insert static data such as system codes and such do that in a final migration, and use SQL statements not model methods. That way you are only relying on the database in the Migration rather than other layers. The challenge here is that the static data is not really part of the database schema and will mess up the database versioning that is part of migrations.

Michael