views:

60

answers:

1

Hello,

I'm thinking about an idea for something, as well as learning Ruby on Rails (easy eh :) ). I want something to allow a user to generate forms as templates, then assign these templates as forms in a location in a tree hierarchy, then allow users to fill in instances of these forms and save the data.

So, I've got two different thoughts as how to structure the data. I'm currently thinking a template will have one or more sections, and a section will have one or more fields and the field will then have attributes (type, color, position, validation etc).

So, should this be described as linked tables ;

field belongs_to_a section belongs_to_a template

or should I have one template table, that has a field called body that can be serialized in and out to XML or something to render ?

<template>
    <section>
        <field attrib=foo attrib2=bar><field>
    </section>
<template>

Any ideas or comments welcome, even if I'm totally on the wrong track....

+1  A: 

I would opt for the first design. If I were a user (or a developer) I'd much rather enter data in logically related tables than write XML to define a screen. In fact, Oracle have used a data structure not unlike this behind their very successful tool Application Express.

Tony Andrews