Sunday, November 05, 2006

How to load fixtures after tables and indexes are created.

Steve Hammond's Blog had this interesting tip:

Can we tell a migration to load the fixtures after it has created the tables and indexes?

Fixtures.create_fixtures('test/fixtures', %w{archetypes tile_types tiles})

The first argument is the directory where the fixtures can be found and the second is an array of fixtures to be loaded. This will load the fixtures into the environment where the fixture is being run. As usual Rails will figure out YAML vs. csv fixtures for you

No comments:

Post a Comment