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:
- http://blog.hasmanythrough.com/2006/8/27/validate-all-your-records (doesnt work in 3.x)
- http://justaddwater.dk/2010/02/07/rake-task-to-validate-all-items-on-all-models/
- https://gist.github.com/xhoy/6510171 Working on rails 3.2.x