The new chapter in Agile Web D. with Rails talks about using
migrations to load data from fixtures. This is a great idea, I’ve
wanted to
do this. This allows you a good way to create sample data that you can
use
during development, testing or demoing of an application. My question
is
how do you keep it separated from the real data? For example, say you
have
a User and Account model. You might end up with migrations like this:
001_create_users.rb
002_load_sample_users.rb
003_create_accounts.rb
004_load_sample_accounts.rb
When you go to production, you don’t want the sample users or accounts
loaded, but when you run rake db:migrate, they will get loaded. Is
there a
way to handle this? It almost seems like loading sample data should be
handled by another script, not in the migrations.