Friday, February 6, 2009

Force Exceptions in Migrations

A couple of times now, I've run a data update migration that failed and didn't throw an Exception. So I ended up with bad data in the system and no knowledge of the problem until the application bombed out in production.

Instead, use the '!' version of save when you do the updates. g.save! throws an exception on failure where g.save does not.

No comments:

Post a Comment