Validate models with DB

Hi, First of all i don’t know if am at the right place for this.

Second i don’t know if this should be part of the rails framework at all.

So this is what happens

Today I deployed a new staging version of an RoR app, then a user came over to me and said there was some functionality not working for him, it did for me…

As it turned out, i extended some validation on some models with a few obscure cases. It turned out these cases did already happen in the wild.

When I thought about this, i wonder if there was anyway to check of my current models matched the current data in the DB and if they were failed. There is a real possibility that when you change validation your current data turns out to be ‘corrupt’.

So I looked around and found some scripts to run over every object and do a obj.valid? and report the results.

Shouldn’t this be part of the default framework? Just like rake db:migrate or rake db:setup?

I suggested adding: rake db:validate

examples: