Validation enhancements -- reflection, overriding, and schema tie-ins

I've been looking at getting more and more information from the underlying database and automatically inserting that into my models. I've read many of the arguments, thoughts, and ideas about this. I understand the different points of view. This sort of thing is more for an integration database and not an application database, and I'm using an integration database.

Also, I don't entirely know the etiquette of the list and I apologize if pasting large blocks of code is gauche, but this is more of a proof-of-concept request-for-comments than a finalized plugin or patch.

So this, below, is a stab at taking validation information from the DDL. I was part-way through this before I learned about the enforce_schema_rules and schema_validations plugins, but those weren't exactly for me. I learned some from them, but there were some things I needed to do differently.

Hey Yossef-

  Looks like you have done some very nice work here. Can I make a suggestion that you make this into a plugin and put it in svn somewhere like rubyforge or another free svn host? Then I think you would get a lot more feedback on this if people can just drop it into their plugins dir and try it out. Let me know if you need a hand making it work as a plugin.

Cheers- -Ezra

Thanks, Ezra.

I figured that would be the case but didn't go the pre-packaged plugin route because of some of the problems mentioned (breaking multiple calls to validates_length_of and validates_format_of). But if it'll get more discussion going as a plugin, a plugin (with caveats) it'll be. I should have time for that sometime soon, maybe this weekend.

Ezra Zygmuntowicz wrote:

Hey Yossef-

  Looks like you have done some very nice work here. Can I make a suggestion that you make this into a plugin and put it in svn somewhere like rubyforge or another free svn host? Then I think you would get a lot more feedback on this if people can just drop it into their plugins dir and try it out. Let me know if you need a hand making it work as a plugin.

Cheers- -Ezra

Ezra,

Thanks again for your comment. I was finally able to get some time to make this a plugin and put it on Rubyforge. It's available at http://rubyforge.org/projects/validate-ddl/.