User defined model and validations?

I am trying to wrap my head around an idea and would appreciate any input from rails geniuses out there

I would like to allow an admin user to define data that should be in a template, and then allow regular users to create instances of this template and have it validated. ie:

- Template would have name, files and then x many fields of say "Text max length 20 chars", "Image size 50x50", "Text 10 chars, not required" etc. - After the template is defined, end user would load it and save implementations of that template.

The template would be easy to create say template has_many template_fields. But how can I load this template, validate it's data and save the instances in another table(s)?

This would be similar to say allowing the admin to define their own forms/fields/validations in the database, then saving instances of these forms. It seems like this would be a fairly common problem, any ideas on this? Is there some type of plugin that might help?

Thanks for any help