Dynamically create tables and models depending on parent.attributes?

Hi everybody!

Given those models:


Maybe my description was a bit too long, but I just wanted to explain
my problem right and give the reader a few more hints.

Any help would be greatly appreciated, and I promise I won't bother
you anymore after this one!