giovedì 10 marzo 2011

Howto: Run a rake task in sandbox mode

If you have a Rails rake task that somehow changes your DB data, but you want to be sure that the DB will be rolled back to its previous state after the rake task has completed, you can simply include this snippet right after your task definition:

If you wonder where is this code coming from, it's directly from the rails console code.

Nessun commento:

Posta un commento